Commit a219994b authored by Urs Thuermann's avatar Urs Thuermann Committed by David S. Miller

[CAN]: Minor clean-ups

Remove unneeded variable.
Rename local variable error to err like in all other places.
Some white-space changes.
Signed-off-by: default avatarUrs Thuermann <urs.thuermann@volkswagen.de>
Signed-off-by: default avatarOliver Hartkopp <oliver.hartkopp@volkswagen.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a2fea5f1
...@@ -98,7 +98,6 @@ static void raw_rcv(struct sk_buff *skb, void *data) ...@@ -98,7 +98,6 @@ static void raw_rcv(struct sk_buff *skb, void *data)
struct sock *sk = (struct sock *)data; struct sock *sk = (struct sock *)data;
struct raw_sock *ro = raw_sk(sk); struct raw_sock *ro = raw_sk(sk);
struct sockaddr_can *addr; struct sockaddr_can *addr;
int error;
if (!ro->recv_own_msgs) { if (!ro->recv_own_msgs) {
/* check the received tx sock reference */ /* check the received tx sock reference */
...@@ -121,14 +120,12 @@ static void raw_rcv(struct sk_buff *skb, void *data) ...@@ -121,14 +120,12 @@ static void raw_rcv(struct sk_buff *skb, void *data)
addr->can_family = AF_CAN; addr->can_family = AF_CAN;
addr->can_ifindex = skb->dev->ifindex; addr->can_ifindex = skb->dev->ifindex;
error = sock_queue_rcv_skb(sk, skb); if (sock_queue_rcv_skb(sk, skb) < 0)
if (error < 0)
kfree_skb(skb); kfree_skb(skb);
} }
static int raw_enable_filters(struct net_device *dev, struct sock *sk, static int raw_enable_filters(struct net_device *dev, struct sock *sk,
struct can_filter *filter, struct can_filter *filter, int count)
int count)
{ {
int err = 0; int err = 0;
int i; int i;
...@@ -163,8 +160,7 @@ static int raw_enable_errfilter(struct net_device *dev, struct sock *sk, ...@@ -163,8 +160,7 @@ static int raw_enable_errfilter(struct net_device *dev, struct sock *sk,
} }
static void raw_disable_filters(struct net_device *dev, struct sock *sk, static void raw_disable_filters(struct net_device *dev, struct sock *sk,
struct can_filter *filter, struct can_filter *filter, int count)
int count)
{ {
int i; int i;
...@@ -353,7 +349,6 @@ static int raw_bind(struct socket *sock, struct sockaddr *uaddr, int len) ...@@ -353,7 +349,6 @@ static int raw_bind(struct socket *sock, struct sockaddr *uaddr, int len)
/* filters set by default/setsockopt */ /* filters set by default/setsockopt */
err = raw_enable_allfilters(dev, sk); err = raw_enable_allfilters(dev, sk);
dev_put(dev); dev_put(dev);
} else { } else {
ifindex = 0; ifindex = 0;
...@@ -466,7 +461,6 @@ static int raw_setsockopt(struct socket *sock, int level, int optname, ...@@ -466,7 +461,6 @@ static int raw_setsockopt(struct socket *sock, int level, int optname,
if (err) { if (err) {
if (count > 1) if (count > 1)
kfree(filter); kfree(filter);
goto out_fil; goto out_fil;
} }
...@@ -673,25 +667,25 @@ static int raw_recvmsg(struct kiocb *iocb, struct socket *sock, ...@@ -673,25 +667,25 @@ static int raw_recvmsg(struct kiocb *iocb, struct socket *sock,
{ {
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
struct sk_buff *skb; struct sk_buff *skb;
int error = 0; int err = 0;
int noblock; int noblock;
noblock = flags & MSG_DONTWAIT; noblock = flags & MSG_DONTWAIT;
flags &= ~MSG_DONTWAIT; flags &= ~MSG_DONTWAIT;
skb = skb_recv_datagram(sk, flags, noblock, &error); skb = skb_recv_datagram(sk, flags, noblock, &err);
if (!skb) if (!skb)
return error; return err;
if (size < skb->len) if (size < skb->len)
msg->msg_flags |= MSG_TRUNC; msg->msg_flags |= MSG_TRUNC;
else else
size = skb->len; size = skb->len;
error = memcpy_toiovec(msg->msg_iov, skb->data, size); err = memcpy_toiovec(msg->msg_iov, skb->data, size);
if (error < 0) { if (err < 0) {
skb_free_datagram(sk, skb); skb_free_datagram(sk, skb);
return error; return err;
} }
sock_recv_timestamp(msg, sk, skb); sock_recv_timestamp(msg, sk, skb);
......
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