diff options
author | YueHaibing <yuehaibing@huawei.com> | 2019-08-31 14:44:24 +0200 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2019-09-07 22:39:30 +0200 |
commit | 5f57704dbcfe8ed718fc7cef0b1699c3aad7739c (patch) | |
tree | 109a63ae0769ee089348c2ae81df84e94c8c9829 /drivers | |
parent | scsi: arm64: dts: qcom: sdm845: Specify UFS device-reset GPIO (diff) | |
download | linux-5f57704dbcfe8ed718fc7cef0b1699c3aad7739c.tar.xz linux-5f57704dbcfe8ed718fc7cef0b1699c3aad7739c.zip |
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')
-rw-r--r-- | drivers/scsi/ufs/ufshcd.c | 3 |
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: |