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:
Ji-Hun Kim
2018-04-06 13:57:20 +09:00
committed by Greg Kroah-Hartman
parent bd6dad98f6
commit 47bda74a2b

View File

@@ -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;