scsi: ufs: fix a missing check of devm_reset_control_get
authorKangjie Lu <kjlu@umn.edu>
Fri, 15 Mar 2019 07:11:56 +0000 (02:11 -0500)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 19 Mar 2019 18:36:28 +0000 (14:36 -0400)
devm_reset_control_get could fail, so the fix checks its return value and
passes the error code upstream in case it fails.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
Acked-by: Avri Altman <avri.altman@wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/ufs/ufs-hisi.c

index 0e855b5afe82a7d93b1183cee2b9223bf0b150c4..2f592df921d974b9836a69089e38f04bfc5638fd 100644 (file)
@@ -587,6 +587,10 @@ static int ufs_hisi_init_common(struct ufs_hba *hba)
        ufshcd_set_variant(hba, host);
 
        host->rst  = devm_reset_control_get(dev, "rst");
+       if (IS_ERR(host->rst)) {
+               dev_err(dev, "%s: failed to get reset control\n", __func__);
+               return PTR_ERR(host->rst);
+       }
 
        ufs_hisi_set_pm_lvl(hba);