提交 45003a1e 编写于 作者: W Wei Yongjun 提交者: Greg Kroah-Hartman

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: NWei Yongjun <weiyongjun1@huawei.com>
Acked-by: NMaciej S. Szmigiero <mail@maciej.szmigiero.name>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 425902f5
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册