summaryrefslogtreecommitdiffstats
path: root/drivers/w1
diff options
context:
space:
mode:
authorWei Yongjun <weiyongjun1@huawei.com>2017-02-09 15:45:42 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-02-10 15:32:53 +0100
commit45003a1e251a9777a55ab46bc49f6ddf747f7f94 (patch)
tree1659fc2c43e3bdc557b416ea9c4957357a40cecf /drivers/w1
parent425902f5c8e3034b2d9d7a714289d8d579c733b2 (diff)
downloadlinux-45003a1e251a9777a55ab46bc49f6ddf747f7f94.tar.bz2
w1: ds2490: use kmemdup rather than duplicating its implementation
Use kmemdup rather than duplicating its implementation. Generated by: scripts/coccinelle/api/memdup.cocci Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Acked-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/w1')
-rw-r--r--drivers/w1/masters/ds2490.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/w1/masters/ds2490.c b/drivers/w1/masters/ds2490.c
index 59d74d1b47a8..be77b7914fad 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);