summaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorYueHaibing <yuehaibing@huawei.com>2019-08-31 12:44:24 +0000
committerMartin K. Petersen <martin.petersen@oracle.com>2019-09-07 16:39:30 -0400
commit5f57704dbcfe8ed718fc7cef0b1699c3aad7739c (patch)
tree109a63ae0769ee089348c2ae81df84e94c8c9829 /drivers/scsi
parent3e303a42a3a8710a64a19fffff5af218403bc8a8 (diff)
downloadlinux-5f57704dbcfe8ed718fc7cef0b1699c3aad7739c.tar.bz2
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>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/ufs/ufshcd.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 5c2eb4866044..c4a015e42045 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -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: