Commit 5f57704d authored by YueHaibing's avatar YueHaibing Committed by Martin K. Petersen

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.comSigned-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
Acked-by: default avatarTomas Winkler <tomas.winkler@intel.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 3e303a42
...@@ -3309,12 +3309,11 @@ int ufshcd_read_string_desc(struct ufs_hba *hba, u8 desc_index, ...@@ -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:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment