mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-13 18:49:22 -04:00
staging: ks7010: replace kmalloc() + memcpy() with kmemdup()
Use kmemdup rather than duplicating its implementation. Signed-off-by: Ji-Hun Kim <ji_hun.kim@samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
bd6dad98f6
commit
47bda74a2b
@@ -589,11 +589,10 @@ static int ks7010_sdio_update_index(struct ks_wlan_private *priv, u32 index)
|
||||
int ret;
|
||||
unsigned char *data_buf;
|
||||
|
||||
data_buf = kmalloc(sizeof(u32), GFP_KERNEL);
|
||||
data_buf = kmemdup(&index, sizeof(u32), GFP_KERNEL);
|
||||
if (!data_buf)
|
||||
return -ENOMEM;
|
||||
|
||||
memcpy(data_buf, &index, sizeof(index));
|
||||
ret = ks7010_sdio_write(priv, WRITE_INDEX, data_buf, sizeof(index));
|
||||
if (ret)
|
||||
goto err_free_data_buf;
|
||||
|
||||
Reference in New Issue
Block a user