linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] w1: ds2490: use kmemdup rather than duplicating its implementation
@ 2017-02-09 15:45 Wei Yongjun
  2017-02-10  1:25 ` Maciej S. Szmigiero
  0 siblings, 1 reply; 2+ messages in thread
From: Wei Yongjun @ 2017-02-09 15:45 UTC (permalink / raw)
  To: Evgeniy Polyakov, Greg Kroah-Hartman, Maciej S. Szmigiero
  Cc: Wei Yongjun, linux-kernel

From: Wei Yongjun <weiyongjun1@huawei.com>

Use kmemdup rather than duplicating its implementation.

Generated by: scripts/coccinelle/api/memdup.cocci

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/w1/masters/ds2490.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/w1/masters/ds2490.c b/drivers/w1/masters/ds2490.c
index 59d74d1..be77b79 100644
--- a/drivers/w1/masters/ds2490.c
+++ b/drivers/w1/masters/ds2490.c
@@ -909,11 +909,10 @@ static void ds9490r_write_block(void *data, const u8 *buf, int len)
 	if (len <= 0)
 		return;
 
-	tbuf = kmalloc(len, GFP_KERNEL);
+	tbuf = kmemdup(buf, len, GFP_KERNEL);
 	if (!tbuf)
 		return;
 
-	memcpy(tbuf, buf, len);
 	ds_write_block(dev, tbuf, len);
 
 	kfree(tbuf);

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

* Re: [PATCH -next] w1: ds2490: use kmemdup rather than duplicating its implementation
  2017-02-09 15:45 [PATCH -next] w1: ds2490: use kmemdup rather than duplicating its implementation Wei Yongjun
@ 2017-02-10  1:25 ` Maciej S. Szmigiero
  0 siblings, 0 replies; 2+ messages in thread
From: Maciej S. Szmigiero @ 2017-02-10  1:25 UTC (permalink / raw)
  To: Wei Yongjun, Evgeniy Polyakov, Greg Kroah-Hartman
  Cc: Wei Yongjun, linux-kernel

On 09.02.2017 16:45, Wei Yongjun wrote:
> From: Wei Yongjun <weiyongjun1@huawei.com>
> 
> Use kmemdup rather than duplicating its implementation.
> 
> Generated by: scripts/coccinelle/api/memdup.cocci
> 
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
>  drivers/w1/masters/ds2490.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Acked-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>

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

end of thread, other threads:[~2017-02-10  1:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-09 15:45 [PATCH -next] w1: ds2490: use kmemdup rather than duplicating its implementation Wei Yongjun
2017-02-10  1:25 ` Maciej S. Szmigiero

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).