The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: <ye.xingchen@zte.com.cn>
To: <3chas3@gmail.com>
Cc: <linux-atm-general@lists.sourceforge.net>,
	<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: [PATCH linux-next] atm: lanai: Use dma_zalloc_coherent()
Date: Tue, 17 Jan 2023 17:21:07 +0800 (CST)	[thread overview]
Message-ID: <202301171721076625091@zte.com.cn> (raw)

From: ye xingchen <ye.xingchen@zte.com.cn>

Instead of using dma_alloc_coherent() and memset() directly use
dma_zalloc_coherent().

Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
---
 drivers/atm/lanai.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/atm/lanai.c b/drivers/atm/lanai.c
index 32d7aa141d96..b7e0199ce642 100644
--- a/drivers/atm/lanai.c
+++ b/drivers/atm/lanai.c
@@ -342,8 +342,8 @@ static void lanai_buf_allocate(struct lanai_buffer *buf,
 		 * everything, but the way the lanai uses DMA memory would
 		 * make that a terrific pain.  This is much simpler.
 		 */
-		buf->start = dma_alloc_coherent(&pci->dev,
-						size, &buf->dmaaddr, GFP_KERNEL);
+		buf->start = dma_zalloc_coherent(&pci->dev,
+						 size, &buf->dmaaddr, GFP_KERNEL);
 		if (buf->start != NULL) {	/* Success */
 			/* Lanai requires 256-byte alignment of DMA bufs */
 			APRINTK((buf->dmaaddr & ~0xFFFFFF00) == 0,
@@ -352,7 +352,6 @@ static void lanai_buf_allocate(struct lanai_buffer *buf,
 			buf->ptr = buf->start;
 			buf->end = (u32 *)
 			    (&((unsigned char *) buf->start)[size]);
-			memset(buf->start, 0, size);
 			break;
 		}
 		size /= 2;
-- 
2.25.1

             reply	other threads:[~2023-01-17  9:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-17  9:21 ye.xingchen [this message]
2023-01-17 15:37 ` [PATCH linux-next] atm: lanai: Use dma_zalloc_coherent() David Laight
2023-01-17 18:42   ` Christophe JAILLET

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202301171721076625091@zte.com.cn \
    --to=ye.xingchen@zte.com.cn \
    --cc=3chas3@gmail.com \
    --cc=linux-atm-general@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox