Received: by 10.192.165.148 with SMTP id m20csp1587377imm; Sat, 28 Apr 2018 00:51:37 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpVloWNEbX3vGR9XkvOYCZuoluGoFKfSypUM+RPrnhadHnZ3lcCaiqLJoEzY/KlSsz+gMUV X-Received: by 10.98.133.154 with SMTP id m26mr4913367pfk.247.1524901897241; Sat, 28 Apr 2018 00:51:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524901897; cv=none; d=google.com; s=arc-20160816; b=bQelhKc/N9l76U0Ln7Su3iZOsswtdpjJ6oUyIoDcG/jFDQEDiL09rSycNfktx+DqLF NTbA4fkNxfVjLElfw/SVtmEqg7PdQFHQR0ZK2KZnI0Vo6WT/n0i2o69Z+K9ezWdmS5eh K+7C0Ld7aiOj4YW7eKPoHnYYYosWqi48/QcVh6hTDI2MEfnt74+d9ZDHgFapIJ5g2OyG S5hQ/+lxdSoFd+HdF4jIMufA1sXsC+rGRNEGCTE8tc4SaVveZSahn+4/nsADXk2j8WR8 V1B/KeqqS4UUhOQtDOnKBTAww8rhdOnBM04nAMJQXqFVLfLJPPPEKragw3A+JTdY6PyT QE+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:arc-authentication-results; bh=r6C39l9rHeLE8oujWsUaqCD7FN5jQ2Sht05yDUy5v2I=; b=njFipnHwMcc6swDMXy5LFKd6NU6lQcOiQF6oxfVLq3KDVOVFl7o+vqQrB6tvjZyPZo DwGPUnYia8jJKqurASiy9qbVih8vLbteeXMPMDCyBuLeMw4GEltkuJ9BJndICUpaDyZO AFT8FVvVg2Tw9uD7Gd1S1TR4A78didyjEyrWz5UWWlCFOy0jzBznpNoIGPdXnsKMMbdN A1ygvmB0a53Ly8L7kHqTeODowxl//WHtefcibxbLWlmu7mwadqrD8eWNIpF6uJ3h1nFu dslFSGTawJCPhCSwsbPvvd6rP7EnBJzeiXe64ubYFbGpbqGC9tHKxy/kO/ePNJOb92FQ N4QA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z86si3096372pfa.120.2018.04.28.00.51.22; Sat, 28 Apr 2018 00:51:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759622AbeD1HuR (ORCPT + 99 others); Sat, 28 Apr 2018 03:50:17 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:41233 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1752688AbeD1HuP (ORCPT ); Sat, 28 Apr 2018 03:50:15 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id B312EF90B5949; Sat, 28 Apr 2018 15:50:11 +0800 (CST) Received: from localhost (10.177.31.96) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.361.1; Sat, 28 Apr 2018 15:50:04 +0800 From: YueHaibing To: , CC: , , , , YueHaibing Subject: [PATCH net-next] can: dev: use skb_put_zero to simplfy code Date: Sat, 28 Apr 2018 15:49:57 +0800 Message-ID: <20180428074957.17084-1-yuehaibing@huawei.com> X-Mailer: git-send-email 2.10.2.windows.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.177.31.96] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org use helper skb_put_zero to replace the pattern of skb_put() && memset() Signed-off-by: YueHaibing --- 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