public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH] staging: rtl8723bs: replace kmalloc + memcpy with kmemdup in sdio_ops.c
       [not found] <20260314-rtl8723bs-kmemdup-sdio-v1-1-b551f87eff8b.ref@yahoo.pl>
@ 2026-03-14 13:30 ` Tomasz Unger
  2026-03-14 21:10   ` Ethan Tidmore
  0 siblings, 1 reply; 2+ messages in thread
From: Tomasz Unger @ 2026-03-14 13:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, Tomasz Unger

Replace kmalloc() followed by memcpy() with kmemdup() which combines
both operations into a single call, making the code cleaner and more
readable.

Signed-off-by: Tomasz Unger <tomasz.unger@yahoo.pl>
---
Verified with checkpatch.pl - no errors or warnings.
Compiled the module successfully.
Module loads without errors in a QEMU environment.
---
 drivers/staging/rtl8723bs/hal/sdio_ops.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/sdio_ops.c b/drivers/staging/rtl8723bs/hal/sdio_ops.c
index c9cb20c61a2b..514c857a998e 100644
--- a/drivers/staging/rtl8723bs/hal/sdio_ops.c
+++ b/drivers/staging/rtl8723bs/hal/sdio_ops.c
@@ -583,12 +583,10 @@ s32 sdio_local_write(
 	)
 		return sd_cmd52_write(intfhdl, addr, cnt, buf);
 
-	tmpbuf = kmalloc(cnt, GFP_ATOMIC);
+	tmpbuf = kmemdup(buf, cnt, GFP_ATOMIC);
 	if (!tmpbuf)
 		return -ENOMEM;
 
-	memcpy(tmpbuf, buf, cnt);
-
 	err = sd_write(intfhdl, addr, cnt, tmpbuf);
 
 	kfree(tmpbuf);

---
base-commit: 2f10e53847d208e97f23ceef3678ce8c88d2ae0e
change-id: 20260314-rtl8723bs-kmemdup-sdio-82fdb1423920

Best regards,
-- 
Tomasz Unger <tomasz.unger@yahoo.pl>


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] staging: rtl8723bs: replace kmalloc + memcpy with kmemdup in sdio_ops.c
  2026-03-14 13:30 ` [PATCH] staging: rtl8723bs: replace kmalloc + memcpy with kmemdup in sdio_ops.c Tomasz Unger
@ 2026-03-14 21:10   ` Ethan Tidmore
  0 siblings, 0 replies; 2+ messages in thread
From: Ethan Tidmore @ 2026-03-14 21:10 UTC (permalink / raw)
  To: Tomasz Unger, Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel

On Sat Mar 14, 2026 at 8:30 AM CDT, Tomasz Unger wrote:
> Replace kmalloc() followed by memcpy() with kmemdup() which combines
> both operations into a single call, making the code cleaner and more
> readable.
>
> Signed-off-by: Tomasz Unger <tomasz.unger@yahoo.pl>
> ---

This doesn't apply against staging-next.

Thanks,

ET

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-03-14 21:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20260314-rtl8723bs-kmemdup-sdio-v1-1-b551f87eff8b.ref@yahoo.pl>
2026-03-14 13:30 ` [PATCH] staging: rtl8723bs: replace kmalloc + memcpy with kmemdup in sdio_ops.c Tomasz Unger
2026-03-14 21:10   ` Ethan Tidmore

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox