Commit 8551e71d authored by YueHaibing's avatar YueHaibing Committed by Marc Kleine-Budde

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: default avatarYueHaibing <yuehaibing@huawei.com>
Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent 9f2d3eae
...@@ -649,8 +649,7 @@ struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf) ...@@ -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)->ifindex = dev->ifindex;
can_skb_prv(skb)->skbcnt = 0; can_skb_prv(skb)->skbcnt = 0;
*cf = skb_put(skb, sizeof(struct can_frame)); *cf = skb_put_zero(skb, sizeof(struct can_frame));
memset(*cf, 0, sizeof(struct can_frame));
return skb; return skb;
} }
...@@ -678,8 +677,7 @@ struct sk_buff *alloc_canfd_skb(struct net_device *dev, ...@@ -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)->ifindex = dev->ifindex;
can_skb_prv(skb)->skbcnt = 0; can_skb_prv(skb)->skbcnt = 0;
*cfd = skb_put(skb, sizeof(struct canfd_frame)); *cfd = skb_put_zero(skb, sizeof(struct canfd_frame));
memset(*cfd, 0, sizeof(struct canfd_frame));
return skb; return 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