diff options
author | Ilpo Järvinen <ilpo.jarvinen@helsinki.fi> | 2008-12-15 02:16:58 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-12-15 02:16:58 -0500 |
commit | ebad5c0984e06f4036d2eb2741b9afce736b8a06 (patch) | |
tree | 7d9af4a5db85b952fbd5b744055f530c4f977921 /net | |
parent | d8eb93078cedbbf4b7e18e1d7054171c7b70b442 (diff) |
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')
-rw-r--r-- | net/can/raw.c | 22 |
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, | |||
641 | 641 | ||
642 | skb = sock_alloc_send_skb(sk, size, msg->msg_flags & MSG_DONTWAIT, | 642 | skb = sock_alloc_send_skb(sk, size, msg->msg_flags & MSG_DONTWAIT, |
643 | &err); | 643 | &err); |
644 | if (!skb) { | 644 | if (!skb) |
645 | dev_put(dev); | 645 | goto put_dev; |
646 | return err; | ||
647 | } | ||
648 | 646 | ||
649 | err = memcpy_fromiovec(skb_put(skb, size), msg->msg_iov, size); | 647 | err = memcpy_fromiovec(skb_put(skb, size), msg->msg_iov, size); |
650 | if (err < 0) { | 648 | if (err < 0) |
651 | kfree_skb(skb); | 649 | goto free_skb; |
652 | dev_put(dev); | ||
653 | return err; | ||
654 | } | ||
655 | skb->dev = dev; | 650 | skb->dev = dev; |
656 | skb->sk = sk; | 651 | skb->sk = sk; |
657 | 652 | ||
@@ -660,9 +655,16 @@ static int raw_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
660 | dev_put(dev); | 655 | dev_put(dev); |
661 | 656 | ||
662 | if (err) | 657 | if (err) |
663 | return err; | 658 | goto send_failed; |
664 | 659 | ||
665 | return size; | 660 | return size; |
661 | |||
662 | free_skb: | ||
663 | kfree_skb(skb); | ||
664 | put_dev: | ||
665 | dev_put(dev); | ||
666 | send_failed: | ||
667 | return err; | ||
666 | } | 668 | } |
667 | 669 | ||
668 | static int raw_recvmsg(struct kiocb *iocb, struct socket *sock, | 670 | static int raw_recvmsg(struct kiocb *iocb, struct socket *sock, |