提交 e780f1c3 编写于 作者: I Ilpo Järvinen 提交者: David S. Miller

irda: merge exit paths

Signed-off-by: NIlpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 037322ab
...@@ -1325,6 +1325,7 @@ int irlap_driver_rcv(struct sk_buff *skb, struct net_device *dev, ...@@ -1325,6 +1325,7 @@ int irlap_driver_rcv(struct sk_buff *skb, struct net_device *dev,
struct irlap_cb *self; struct irlap_cb *self;
int command; int command;
__u8 control; __u8 control;
int ret = -1;
if (!net_eq(dev_net(dev), &init_net)) if (!net_eq(dev_net(dev), &init_net))
goto out; goto out;
...@@ -1333,25 +1334,21 @@ int irlap_driver_rcv(struct sk_buff *skb, struct net_device *dev, ...@@ -1333,25 +1334,21 @@ int irlap_driver_rcv(struct sk_buff *skb, struct net_device *dev,
self = (struct irlap_cb *) dev->atalk_ptr; self = (struct irlap_cb *) dev->atalk_ptr;
/* If the net device is down, then IrLAP is gone! */ /* If the net device is down, then IrLAP is gone! */
if (!self || self->magic != LAP_MAGIC) { if (!self || self->magic != LAP_MAGIC)
dev_kfree_skb(skb); goto err;
return -1;
}
/* We are no longer an "old" protocol, so we need to handle /* We are no longer an "old" protocol, so we need to handle
* share and non linear skbs. This should never happen, so * share and non linear skbs. This should never happen, so
* we don't need to be clever about it. Jean II */ * we don't need to be clever about it. Jean II */
if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) { if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) {
IRDA_ERROR("%s: can't clone shared skb!\n", __func__); IRDA_ERROR("%s: can't clone shared skb!\n", __func__);
dev_kfree_skb(skb); goto err;
return -1;
} }
/* Check if frame is large enough for parsing */ /* Check if frame is large enough for parsing */
if (!pskb_may_pull(skb, 2)) { if (!pskb_may_pull(skb, 2)) {
IRDA_ERROR("%s: frame too short!\n", __func__); IRDA_ERROR("%s: frame too short!\n", __func__);
dev_kfree_skb(skb); goto err;
return -1;
} }
command = skb->data[0] & CMD_FRAME; command = skb->data[0] & CMD_FRAME;
...@@ -1442,7 +1439,9 @@ int irlap_driver_rcv(struct sk_buff *skb, struct net_device *dev, ...@@ -1442,7 +1439,9 @@ int irlap_driver_rcv(struct sk_buff *skb, struct net_device *dev,
break; break;
} }
out: out:
ret = 0;
err:
/* Always drop our reference on the skb */ /* Always drop our reference on the skb */
dev_kfree_skb(skb); dev_kfree_skb(skb);
return 0; return ret;
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册