LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH net-next] can: dev: use skb_put_zero to simplfy code
@ 2018-04-28 7:49 YueHaibing
2018-04-29 16:24 ` Marc Kleine-Budde
0 siblings, 1 reply; 2+ messages in thread
From: YueHaibing @ 2018-04-28 7:49 UTC (permalink / raw)
To: wg, mkl; +Cc: netdev, linux-can, davem, linux-kernel, YueHaibing
use helper skb_put_zero to replace the pattern of skb_put() && memset()
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
drivers/net/can/dev.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
index b177956..d8140a9 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;
}
--
2.7.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] can: dev: use skb_put_zero to simplfy code
2018-04-28 7:49 [PATCH net-next] can: dev: use skb_put_zero to simplfy code YueHaibing
@ 2018-04-29 16:24 ` Marc Kleine-Budde
0 siblings, 0 replies; 2+ messages in thread
From: Marc Kleine-Budde @ 2018-04-29 16:24 UTC (permalink / raw)
To: YueHaibing, wg; +Cc: netdev, linux-can, davem, linux-kernel
[-- Attachment #1.1: Type: text/plain, Size: 496 bytes --]
On 04/28/2018 09:49 AM, YueHaibing wrote:
> use helper skb_put_zero to replace the pattern of skb_put() && memset()
>
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Applied to linux-can-next.
Tnx,
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-04-30 7:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-28 7:49 [PATCH net-next] can: dev: use skb_put_zero to simplfy code YueHaibing
2018-04-29 16:24 ` Marc Kleine-Budde
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).