Commit 2f4a784f authored by Phillip Potter's avatar Phillip Potter Committed by Greg Kroah-Hartman

scsi: ufs: handle cleanup correctly on devm_reset_control_get error

Move ufshcd_set_variant call in ufs_hisi_init_common to common error
section at end of the function, and then jump to this from the error
checking statements for both devm_reset_control_get and
ufs_hisi_get_resource. This fixes the original commit (63a06181)
which was reverted due to the University of Minnesota problems.
Suggested-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Avri Altman <avri.altman@wdc.com>
Cc: Martin K. Petersen <martin.petersen@oracle.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: default avatarPhillip Potter <phil@philpotter.co.uk>
Link: https://lore.kernel.org/r/20210503115736.2104747-32-gregkh@linuxfoundation.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 4d427b40
...@@ -467,17 +467,24 @@ static int ufs_hisi_init_common(struct ufs_hba *hba) ...@@ -467,17 +467,24 @@ static int ufs_hisi_init_common(struct ufs_hba *hba)
host->hba = hba; host->hba = hba;
ufshcd_set_variant(hba, host); ufshcd_set_variant(hba, host);
host->rst = devm_reset_control_get(dev, "rst"); host->rst = devm_reset_control_get(dev, "rst");
if (IS_ERR(host->rst)) {
dev_err(dev, "%s: failed to get reset control\n", __func__);
err = PTR_ERR(host->rst);
goto error;
}
ufs_hisi_set_pm_lvl(hba); ufs_hisi_set_pm_lvl(hba);
err = ufs_hisi_get_resource(host); err = ufs_hisi_get_resource(host);
if (err) { if (err)
ufshcd_set_variant(hba, NULL); goto error;
return err;
}
return 0; return 0;
error:
ufshcd_set_variant(hba, NULL);
return err;
} }
static int ufs_hi3660_init(struct ufs_hba *hba) static int ufs_hi3660_init(struct ufs_hba *hba)
......
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