scsi: ufs: Use kmemdup in ufshcd_read_string_desc()
Use kmemdup rather than duplicating its implementation Link: https://lore.kernel.org/r/20190831124424.18642-1-yuehaibing@huawei.com Signed-off-by: YueHaibing <yuehaibing@huawei.com> Acked-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
Родитель
3e303a42a3
Коммит
5f57704dbc
|
@ -3309,12 +3309,11 @@ int ufshcd_read_string_desc(struct ufs_hba *hba, u8 desc_index,
|
||||||
str[ret++] = '\0';
|
str[ret++] = '\0';
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
str = kzalloc(uc_str->len, GFP_KERNEL);
|
str = kmemdup(uc_str, uc_str->len, GFP_KERNEL);
|
||||||
if (!str) {
|
if (!str) {
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
memcpy(str, uc_str, uc_str->len);
|
|
||||||
ret = uc_str->len;
|
ret = uc_str->len;
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
|
|
Загрузка…
Ссылка в новой задаче