Commit e780f1c33d76ebb81607a6b5d6b669edb9065a7f
Committed by
David S. Miller
1 parent
037322abe6
Exists in
master
and in
7 other branches
irda: merge exit paths
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi> Signed-off-by: David S. Miller <davem@davemloft.net>
Showing 1 changed file with 8 additions and 9 deletions Side-by-side Diff
net/irda/irlap_frame.c
... | ... | @@ -1325,6 +1325,7 @@ |
1325 | 1325 | struct irlap_cb *self; |
1326 | 1326 | int command; |
1327 | 1327 | __u8 control; |
1328 | + int ret = -1; | |
1328 | 1329 | |
1329 | 1330 | if (!net_eq(dev_net(dev), &init_net)) |
1330 | 1331 | goto out; |
1331 | 1332 | |
1332 | 1333 | |
... | ... | @@ -1333,25 +1334,21 @@ |
1333 | 1334 | self = (struct irlap_cb *) dev->atalk_ptr; |
1334 | 1335 | |
1335 | 1336 | /* If the net device is down, then IrLAP is gone! */ |
1336 | - if (!self || self->magic != LAP_MAGIC) { | |
1337 | - dev_kfree_skb(skb); | |
1338 | - return -1; | |
1339 | - } | |
1337 | + if (!self || self->magic != LAP_MAGIC) | |
1338 | + goto err; | |
1340 | 1339 | |
1341 | 1340 | /* We are no longer an "old" protocol, so we need to handle |
1342 | 1341 | * share and non linear skbs. This should never happen, so |
1343 | 1342 | * we don't need to be clever about it. Jean II */ |
1344 | 1343 | if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) { |
1345 | 1344 | IRDA_ERROR("%s: can't clone shared skb!\n", __func__); |
1346 | - dev_kfree_skb(skb); | |
1347 | - return -1; | |
1345 | + goto err; | |
1348 | 1346 | } |
1349 | 1347 | |
1350 | 1348 | /* Check if frame is large enough for parsing */ |
1351 | 1349 | if (!pskb_may_pull(skb, 2)) { |
1352 | 1350 | IRDA_ERROR("%s: frame too short!\n", __func__); |
1353 | - dev_kfree_skb(skb); | |
1354 | - return -1; | |
1351 | + goto err; | |
1355 | 1352 | } |
1356 | 1353 | |
1357 | 1354 | command = skb->data[0] & CMD_FRAME; |
1358 | 1355 | |
... | ... | @@ -1442,8 +1439,10 @@ |
1442 | 1439 | break; |
1443 | 1440 | } |
1444 | 1441 | out: |
1442 | + ret = 0; | |
1443 | +err: | |
1445 | 1444 | /* Always drop our reference on the skb */ |
1446 | 1445 | dev_kfree_skb(skb); |
1447 | - return 0; | |
1446 | + return ret; | |
1448 | 1447 | } |