diff mbox series

[v2] scsi: ufs: fix a missing check of devm_reset_control_get

Message ID 20190315071156.21588-1-kjlu@umn.edu (mailing list archive)
State Mainlined
Commit 63a06181d7ce169d09843645c50fea1901bc9f0a
Headers show
Series [v2] scsi: ufs: fix a missing check of devm_reset_control_get | expand

Commit Message

Kangjie Lu March 15, 2019, 7:11 a.m. UTC
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>

---
V2: Use full line please
---
 drivers/scsi/ufs/ufs-hisi.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Martin K. Petersen March 19, 2019, 6:37 p.m. UTC | #1
Kangjie,

> devm_reset_control_get could fail, so the fix checks its return value
> and passes the error code upstream in case it fails.

Applied to 5.2/scsi-queue, thanks.
diff mbox series

Patch

diff --git a/drivers/scsi/ufs/ufs-hisi.c b/drivers/scsi/ufs/ufs-hisi.c
index 452e19f8fb47..c2cee73a8560 100644
--- a/drivers/scsi/ufs/ufs-hisi.c
+++ b/drivers/scsi/ufs/ufs-hisi.c
@@ -544,6 +544,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);