mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-19 04:14:49 +08:00
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:
parent
3e303a42a3
commit
5f57704dbc
@ -3309,12 +3309,11 @@ int ufshcd_read_string_desc(struct ufs_hba *hba, u8 desc_index,
|
||||
str[ret++] = '\0';
|
||||
|
||||
} else {
|
||||
str = kzalloc(uc_str->len, GFP_KERNEL);
|
||||
str = kmemdup(uc_str, uc_str->len, GFP_KERNEL);
|
||||
if (!str) {
|
||||
ret = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
memcpy(str, uc_str, uc_str->len);
|
||||
ret = uc_str->len;
|
||||
}
|
||||
out:
|
||||
|
Loading…
Reference in New Issue
Block a user