summaryrefslogtreecommitdiffstats
path: root/net/can
diff options
context:
space:
mode:
authorIlpo Järvinen <ilpo.jarvinen@helsinki.fi>2008-12-15 08:16:58 +0100
committerDavid S. Miller <davem@davemloft.net>2008-12-15 08:16:58 +0100
commitebad5c0984e06f4036d2eb2741b9afce736b8a06 (patch)
tree7d9af4a5db85b952fbd5b744055f530c4f977921 /net/can
parentxfrm: join error paths (diff)
downloadlinux-ebad5c0984e06f4036d2eb2741b9afce736b8a06.tar.xz
linux-ebad5c0984e06f4036d2eb2741b9afce736b8a06.zip
can: merge error paths
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/can')
-rw-r--r--net/can/raw.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/net/can/raw.c b/net/can/raw.c
index 6e0663faaf9f..27aab63df467 100644
--- a/net/can/raw.c
+++ b/net/can/raw.c
@@ -641,17 +641,12 @@ static int raw_sendmsg(struct kiocb *iocb, struct socket *sock,
skb = sock_alloc_send_skb(sk, size, msg->msg_flags & MSG_DONTWAIT,
&err);
- if (!skb) {
- dev_put(dev);
- return err;
- }
+ if (!skb)
+ goto put_dev;
err = memcpy_fromiovec(skb_put(skb, size), msg->msg_iov, size);
- if (err < 0) {
- kfree_skb(skb);
- dev_put(dev);
- return err;
- }
+ if (err < 0)
+ goto free_skb;
skb->dev = dev;
skb->sk = sk;
@@ -660,9 +655,16 @@ static int raw_sendmsg(struct kiocb *iocb, struct socket *sock,
dev_put(dev);
if (err)
- return err;
+ goto send_failed;
return size;
+
+free_skb:
+ kfree_skb(skb);
+put_dev:
+ dev_put(dev);
+send_failed:
+ return err;
}
static int raw_recvmsg(struct kiocb *iocb, struct socket *sock,