mhi: core: use kmemdup rather than duplicating it's implementation

Use kmemdup, instead of using kmalloc, and memcpy combo.

CRs-Fixed: 2258358
Change-Id: I941ee2fa3a4b47dd0a2a5833ee52445a553f3aa6
Signed-off-by: Sujeev Dias <sdias@codeaurora.org>
This commit is contained in:
Sujeev Dias 2018-06-18 17:20:11 -07:00
parent a3c82028fa
commit e54b71ebbf

View File

@ -506,7 +506,7 @@ void mhi_fw_load_worker(struct work_struct *work)
if (size > firmware->size)
size = firmware->size;
buf = kmalloc(size, GFP_KERNEL);
buf = kmemdup(firmware->data, size, GFP_KERNEL);
if (!buf) {
MHI_ERR("Could not allocate memory for image\n");
release_firmware(firmware);
@ -514,7 +514,6 @@ void mhi_fw_load_worker(struct work_struct *work)
}
/* load sbl image */
memcpy(buf, firmware->data, size);
ret = mhi_fw_load_sbl(mhi_cntrl, buf, size);
kfree(buf);