Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1577714 > unrolled thread

[PATCH -next] w1: ds2490: use kmemdup rather than duplicating its implementation

Started byWei Yongjun <weiyj.lk@gmail.com>
First post2017-02-09 16:50 +0100
Last post2017-02-10 02:50 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH -next] w1: ds2490: use kmemdup rather than duplicating its implementation Wei Yongjun <weiyj.lk@gmail.com> - 2017-02-09 16:50 +0100
    Re: [PATCH -next] w1: ds2490: use kmemdup rather than duplicating its  implementation "Maciej S. Szmigiero" <mail@maciej.szmigiero.name> - 2017-02-10 02:50 +0100

#1577714 — [PATCH -next] w1: ds2490: use kmemdup rather than duplicating its implementation

FromWei Yongjun <weiyj.lk@gmail.com>
Date2017-02-09 16:50 +0100
Subject[PATCH -next] w1: ds2490: use kmemdup rather than duplicating its implementation
Message-ID<t8Z8R-7WR-9@gated-at.bofh.it>
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);

[toc] | [next] | [standalone]


#1578101 — Re: [PATCH -next] w1: ds2490: use kmemdup rather than duplicating its implementation

From"Maciej S. Szmigiero" <mail@maciej.szmigiero.name>
Date2017-02-10 02:50 +0100
SubjectRe: [PATCH -next] w1: ds2490: use kmemdup rather than duplicating its implementation
Message-ID<t98vw-5lK-15@gated-at.bofh.it>
In reply to#1577714
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>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web