summaryrefslogtreecommitdiffstats
path: root/drivers/net/can/dev.c
diff options
context:
space:
mode:
authorYueHaibing <yuehaibing@huawei.com>2018-04-28 09:49:57 +0200
committerMarc Kleine-Budde <mkl@pengutronix.de>2018-07-27 10:40:16 +0200
commit8551e71d1063edfaab03585e5f78077ec1c85da3 (patch)
treeca44d7530154cf0ac3d82076c4fe8f6b7ae08ee0 /drivers/net/can/dev.c
parentcan: ucan: add driver for Theobroma Systems UCAN devices (diff)
downloadlinux-8551e71d1063edfaab03585e5f78077ec1c85da3.tar.xz
linux-8551e71d1063edfaab03585e5f78077ec1c85da3.zip
can: dev: use skb_put_zero to simplfy code
use helper skb_put_zero to replace the pattern of skb_put() && memset() Signed-off-by: YueHaibing <yuehaibing@huawei.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can/dev.c')
-rw-r--r--drivers/net/can/dev.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
index 3c71f1cb205f..5bb6e8896601 100644
--- a/drivers/net/can/dev.c
+++ b/drivers/net/can/dev.c
@@ -649,8 +649,7 @@ struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf)
can_skb_prv(skb)->ifindex = dev->ifindex;
can_skb_prv(skb)->skbcnt = 0;
- *cf = skb_put(skb, sizeof(struct can_frame));
- memset(*cf, 0, sizeof(struct can_frame));
+ *cf = skb_put_zero(skb, sizeof(struct can_frame));
return skb;
}
@@ -678,8 +677,7 @@ struct sk_buff *alloc_canfd_skb(struct net_device *dev,
can_skb_prv(skb)->ifindex = dev->ifindex;
can_skb_prv(skb)->skbcnt = 0;
- *cfd = skb_put(skb, sizeof(struct canfd_frame));
- memset(*cfd, 0, sizeof(struct canfd_frame));
+ *cfd = skb_put_zero(skb, sizeof(struct canfd_frame));
return skb;
}