Message ID | f44be04317387f8936d31d5470963541615f30ef.1685283065.git.christophe.jaillet@wanadoo.fr |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp982341vqr; Sun, 28 May 2023 07:22:49 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5xOmSBDj3YLbFGvB+3sWrGKxhn30lpu3oQw0FqV5EYdfBHc57DuUttVO4Jvf9+6OLFMNah X-Received: by 2002:a05:6a00:810:b0:64d:1e10:5000 with SMTP id m16-20020a056a00081000b0064d1e105000mr11742838pfk.14.1685283768754; Sun, 28 May 2023 07:22:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685283768; cv=none; d=google.com; s=arc-20160816; b=hMkCkpa/XLvXMUWjiQZJEWaPaGw1p/hpSFQgeoxYinYYP1M3savBPV1P5m+VCTQzHz CD4Wkclb+FVOnbaRXkX+Dbf1A+2bPGY1/oblWwltGMi8ShEBUiOu5fp0iqCHOyolZwm/ D25ioQdJbVC5VA67pXLXwbZqNAaakHGlXsqI3v9HJjMt3jocVnwkdnHTeHEl2zwJG/C4 cGExUNWyvdE1r2UlguFZsEtlMmGCa9pvSqp9gGH/QS3TaiFLgWnKa4PtWW+3o+xpIUbT 9bheqMgn5VTP6PA/AT0jZMDFTcu0dD9cJl60uDTeiGYXtmEy+Gu6eq4c87oDMJGeWFOj sacA== 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:dkim-signature; bh=y3+xzWyNMJI6Fo1vf7HM2FwwEMDemy6nUMbYmtfSJAo=; b=bvPnu5zKjJGBHV6WAlLJbDJrDgFBpFVNM2ZCVRscWSwPE0+VOEcgRTOfU8+RZOozA6 S/DztCNbQezVxDswR7aIAZIfE5ZJDcCPK5Nl1rMf3cWGhpt/irX2A1tI/GG9n5QRQS7r Ac3FemCUuqkMbWJwLez1e0jR91NFCFxAww9Zo8SbfWrXv/aQ5ZHh7tJmwXvk3Im47WPX s7C1tHrI6HnnvhmBwA5mCvwwZ2ODXhBAkeoy7SMntCqsdo3BwWTT4c/x889D6jBRLk5N aigJWjlycccx2scC3Xw8M9Jzuz4CpgnqrpwgDXRlpnzHCBJu/2a8MhlvBm2tQW165Q33 qLOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=MkqYroq8; 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 z129-20020a626587000000b0064490c20e80si7940152pfb.59.2023.05.28.07.22.34; Sun, 28 May 2023 07:22:48 -0700 (PDT) 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; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=MkqYroq8; 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 S229450AbjE1OMB (ORCPT <rfc822;syz17693488234@gmail.com> + 99 others); Sun, 28 May 2023 10:12:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229524AbjE1OMA (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 28 May 2023 10:12:00 -0400 Received: from smtp.smtpout.orange.fr (smtp-23.smtpout.orange.fr [80.12.242.23]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E3F8C7 for <linux-kernel@vger.kernel.org>; Sun, 28 May 2023 07:11:58 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id 3H7jq4uCWZO7A3H7jqkgSo; Sun, 28 May 2023 16:11:56 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1685283116; bh=y3+xzWyNMJI6Fo1vf7HM2FwwEMDemy6nUMbYmtfSJAo=; h=From:To:Cc:Subject:Date; b=MkqYroq869dWCNPUaGO8IPR2Eei6nlkHrBoAFM8ZtoR7LOZesAA/wfZThpcPpNDA0 APsGbRNmo+0lERhGQ4/FjUenENWDqx4vGreOPNIxs4kcdqVrkGP1olHL+qIIwLKN82 N+BMfwz78eTUdtkQMesHOA5mhVy+8Bevnp/ND9tWOxcLbwhfMdt7fpho2vY9KPyv8o gjdbB3+OsaRuThkxSvxhQtBdpWp7Qr3KU7I/VS/gqp8DP7RhOwDnb6dOMzdZdd8pDz FcqL/aijEt0h12vC6pT/Ywxtb9nufUKaty2CLRlDyIrSOsYEr5tLh99CXD2LbNo4Rf o7YxqqMVgcqMQ== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 28 May 2023 16:11:56 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET <christophe.jaillet@wanadoo.fr> To: Fenghua Yu <fenghua.yu@intel.com>, Dave Jiang <dave.jiang@intel.com>, Vinod Koul <vkoul@kernel.org> Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET <christophe.jaillet@wanadoo.fr>, dmaengine@vger.kernel.org Subject: [PATCH] dmaengine: idxd: No need to clear memory after a dma_alloc_coherent() call Date: Sun, 28 May 2023 16:11:54 +0200 Message-Id: <f44be04317387f8936d31d5470963541615f30ef.1685283065.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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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?1767148113077149770?= X-GMAIL-MSGID: =?utf-8?q?1767148113077149770?= |
Series |
dmaengine: idxd: No need to clear memory after a dma_alloc_coherent() call
|
|
Commit Message
Christophe JAILLET
May 28, 2023, 2:11 p.m. UTC
dma_alloc_coherent() already clear the allocated memory, there is no need
to explicitly call memset().
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
drivers/dma/idxd/device.c | 2 --
1 file changed, 2 deletions(-)
Comments
On 5/28/23 07:11, Christophe JAILLET wrote: > dma_alloc_coherent() already clear the allocated memory, there is no need > to explicitly call memset(). > > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Acked-by: Dave Jiang <dave.jiang@intel.com> > --- > drivers/dma/idxd/device.c | 2 -- > 1 file changed, 2 deletions(-) > > diff --git a/drivers/dma/idxd/device.c b/drivers/dma/idxd/device.c > index 5abbcc61c528..7c74bc60f582 100644 > --- a/drivers/dma/idxd/device.c > +++ b/drivers/dma/idxd/device.c > @@ -786,8 +786,6 @@ static int idxd_device_evl_setup(struct idxd_device *idxd) > goto err_alloc; > } > > - memset(addr, 0, size); > - > spin_lock(&evl->lock); > evl->log = addr; > evl->dma = dma_addr;
On 5/28/23 07:11, Christophe JAILLET wrote: > dma_alloc_coherent() already clear the allocated memory, there is no need > to explicitly call memset(). > > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Acked-by: Fenghua Yu <fenghua.yu@intel.com> Thanks. -Fenghua
On 28/05/2023 16:11, Christophe JAILLET wrote: > dma_alloc_coherent() already clear the allocated memory, there is no need > to explicitly call memset(). Hmm, so wouldn't be dma_zalloc_coherent() a better name for the function? Kind regards, Bernd
Le 30/05/2023 à 17:54, Bernd Petrovitsch a écrit : > On 28/05/2023 16:11, Christophe JAILLET wrote: >> dma_alloc_coherent() already clear the allocated memory, there is no need >> to explicitly call memset(). > > Hmm, so wouldn't be dma_zalloc_coherent() a better name for the function? > > Kind regards, > Bernd Hi, No strong opinion about it. It is not malloc either !) When dma_zalloc_coherent() has been deprecated (see [1]), for some reason, it was decided to keep the "alloc" version. CJ [1]: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/include/linux/dma-mapping.h?id=06d4dd2f2ce1cdb625f77c0676d5af6ba310c01d
On Sun, 28 May 2023 16:11:54 +0200, Christophe JAILLET wrote: > dma_alloc_coherent() already clear the allocated memory, there is no need > to explicitly call memset(). > > Applied, thanks! [1/1] dmaengine: idxd: No need to clear memory after a dma_alloc_coherent() call commit: 61e2cd90681e91ee8202d22e5ca25b1100557fc4 Best regards,
diff --git a/drivers/dma/idxd/device.c b/drivers/dma/idxd/device.c index 5abbcc61c528..7c74bc60f582 100644 --- a/drivers/dma/idxd/device.c +++ b/drivers/dma/idxd/device.c @@ -786,8 +786,6 @@ static int idxd_device_evl_setup(struct idxd_device *idxd) goto err_alloc; } - memset(addr, 0, size); - spin_lock(&evl->lock); evl->log = addr; evl->dma = dma_addr;