[net-next] net: ethernet: mtk_wed: No need to clear memory after a dma_alloc_coherent() call
Message ID | d5acce7dd108887832c9719f62c7201b4c83b3fb.1676184599.git.christophe.jaillet@wanadoo.fr |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1806514wrn; Sat, 11 Feb 2023 23:40:54 -0800 (PST) X-Google-Smtp-Source: AK7set8UoeKt0gw2Fdx1ym4EunmMgI2paBmo5bfq2v5Ju+aAwS2FiI/d/M8u/3kAvgZyMulAjHzG X-Received: by 2002:a50:d692:0:b0:4a2:51db:c7c6 with SMTP id r18-20020a50d692000000b004a251dbc7c6mr21282119edi.8.1676187654346; Sat, 11 Feb 2023 23:40:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676187654; cv=none; d=google.com; s=arc-20160816; b=sv3hCA0EDzGBw4ez/b1WKleuXj36u5fGH/BlG2wWXWyXsIkIQNQcU3ts3GThclw1IR M0tQflmr9Ypw/aTNGblXDdyg3ppXfKXSincqBefFRP9VK6aJFVyrBlEmTTf5Gow/XtfC CPyYSi9uxxlXs1jzCEFSxoPDu/sfemZ+KXMRMuEiXtcJXXzeuvHsER+mRZQLDuiKJkxZ nwz8XgKOZet6r/qBFEjcItiV+swlqZer44Qs1oP9zULTk48sqCK0K/uYXU7TsRNY3fcj +QNmRN6ctIlCWR7JMuYXo2tdVVxTKwrp5z05NSq/Sp6sRwUfQ5VYAXjY5dR0uLyEI4/0 738w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=RJdKgApzExava2yzmGGZ4f7XbHFq1+CyNPUaliExuYY=; b=ecNeIXaomw13Ln0nlWFcXYoqxVlFUvTzY0dpQUApvHsM8JsJtngSFlJVuAEvmZEwNh 0HXuWQndQfDX8sVmiZ0JkqnEHY04sZsTCxyJscy4yWGnXkLGLQIgJ4LUBAMH6ntFIUi7 WgVI2Jlpeb6h/43yrTyx9QChj996JDY1ilJXqbRf9LL9yInp3pJxODWmT1PJ60eKkM5X 7rmU7VUEATBwEs4rUSdULd8rqcMSZSNqS3m+zThsh4oUkuNyH2qnxUFNkentUVFJSEzF aNMdY03oH6jfV+RDItEOLts4jHHDgR9NbKiiR65try4mRfDalXEn8c+R14h5iJ4/9pp/ HnsA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z14-20020aa7d40e000000b004acb6bcb283si4035962edq.620.2023.02.11.23.40.29; Sat, 11 Feb 2023 23:40:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229533AbjBLGwI (ORCPT <rfc822;tebrre53rla2o@gmail.com> + 99 others); Sun, 12 Feb 2023 01:52:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229485AbjBLGwH (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 12 Feb 2023 01:52:07 -0500 Received: from smtp.smtpout.orange.fr (smtp-17.smtpout.orange.fr [80.12.242.17]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DFD5414233 for <linux-kernel@vger.kernel.org>; Sat, 11 Feb 2023 22:52:05 -0800 (PST) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id R6DPpfF8cfKYFR6DPpGS8u; Sun, 12 Feb 2023 07:52:03 +0100 X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 12 Feb 2023 07:52:03 +0100 X-ME-IP: 86.243.2.178 From: Christophe JAILLET <christophe.jaillet@wanadoo.fr> To: Felix Fietkau <nbd@nbd.name>, John Crispin <john@phrozen.org>, Sean Wang <sean.wang@mediatek.com>, Mark Lee <Mark-MC.Lee@mediatek.com>, Lorenzo Bianconi <lorenzo@kernel.org>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Matthias Brugger <matthias.bgg@gmail.com>, AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET <christophe.jaillet@wanadoo.fr>, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH net-next] net: ethernet: mtk_wed: No need to clear memory after a dma_alloc_coherent() call Date: Sun, 12 Feb 2023 07:51:51 +0100 Message-Id: <d5acce7dd108887832c9719f62c7201b4c83b3fb.1676184599.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757610145752064837?= X-GMAIL-MSGID: =?utf-8?q?1757610145752064837?= |
Series |
[net-next] net: ethernet: mtk_wed: No need to clear memory after a dma_alloc_coherent() call
|
|
Commit Message
Christophe JAILLET
Feb. 12, 2023, 6:51 a.m. UTC
dma_alloc_coherent() already clears the allocated memory, there is no need
to explicitly call memset().
Moreover, it is likely that the size in the memset() is incorrect and
should be "size * sizeof(*ring->desc)".
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
drivers/net/ethernet/mediatek/mtk_wed.c | 1 -
1 file changed, 1 deletion(-)
Comments
Hello: This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <kuba@kernel.org>: On Sun, 12 Feb 2023 07:51:51 +0100 you wrote: > dma_alloc_coherent() already clears the allocated memory, there is no need > to explicitly call memset(). > > Moreover, it is likely that the size in the memset() is incorrect and > should be "size * sizeof(*ring->desc)". > > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> > > [...] Here is the summary with links: - [net-next] net: ethernet: mtk_wed: No need to clear memory after a dma_alloc_coherent() call https://git.kernel.org/netdev/net-next/c/511b88fedab4 You are awesome, thank you!
diff --git a/drivers/net/ethernet/mediatek/mtk_wed.c b/drivers/net/ethernet/mediatek/mtk_wed.c index 95ac4f71d2b2..95d890870984 100644 --- a/drivers/net/ethernet/mediatek/mtk_wed.c +++ b/drivers/net/ethernet/mediatek/mtk_wed.c @@ -787,7 +787,6 @@ mtk_wed_rro_ring_alloc(struct mtk_wed_device *dev, struct mtk_wed_ring *ring, ring->desc_size = sizeof(*ring->desc); ring->size = size; - memset(ring->desc, 0, size); return 0; }