Commit ebad5c09 authored by Ilpo Järvinen's avatar Ilpo Järvinen Committed by David S. Miller

can: merge error paths

Signed-off-by: default avatarIlpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d8eb9307
...@@ -641,17 +641,12 @@ static int raw_sendmsg(struct kiocb *iocb, struct socket *sock, ...@@ -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, skb = sock_alloc_send_skb(sk, size, msg->msg_flags & MSG_DONTWAIT,
&err); &err);
if (!skb) { if (!skb)
dev_put(dev); goto put_dev;
return err;
}
err = memcpy_fromiovec(skb_put(skb, size), msg->msg_iov, size); err = memcpy_fromiovec(skb_put(skb, size), msg->msg_iov, size);
if (err < 0) { if (err < 0)
kfree_skb(skb); goto free_skb;
dev_put(dev);
return err;
}
skb->dev = dev; skb->dev = dev;
skb->sk = sk; skb->sk = sk;
...@@ -660,9 +655,16 @@ static int raw_sendmsg(struct kiocb *iocb, struct socket *sock, ...@@ -660,9 +655,16 @@ static int raw_sendmsg(struct kiocb *iocb, struct socket *sock,
dev_put(dev); dev_put(dev);
if (err) if (err)
return err; goto send_failed;
return size; 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, static int raw_recvmsg(struct kiocb *iocb, struct socket *sock,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment