Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Wei Yongjun and committed by
Greg Kroah-Hartman
45003a1e 425902f5

+1 -2
+1 -2
drivers/w1/masters/ds2490.c
··· 909 909 if (len <= 0) 910 910 return; 911 911 912 - tbuf = kmalloc(len, GFP_KERNEL); 912 + tbuf = kmemdup(buf, len, GFP_KERNEL); 913 913 if (!tbuf) 914 914 return; 915 915 916 - memcpy(tbuf, buf, len); 917 916 ds_write_block(dev, tbuf, len); 918 917 919 918 kfree(tbuf);