linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: ufs: fix a missing check of devm_reset_control_get
@ 2019-03-14  6:37 Kangjie Lu
  2019-03-14  9:15 ` Avri Altman
  0 siblings, 1 reply; 4+ messages in thread
From: Kangjie Lu @ 2019-03-14  6:37 UTC (permalink / raw)
  To: kjlu
  Cc: pakki001, Vinayak Holikatti, James E.J. Bottomley,
	Martin K. Petersen, linux-scsi, linux-kernel

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

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
 drivers/scsi/ufs/ufs-hisi.c | 5 +++++
 1 file changed, 5 insertions(+)

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [PATCH] scsi: ufs: fix a missing check of devm_reset_control_get
  2019-03-14  6:37 [PATCH] scsi: ufs: fix a missing check of devm_reset_control_get Kangjie Lu
@ 2019-03-14  9:15 ` Avri Altman
  2019-03-15  7:11   ` [PATCH v2] " Kangjie Lu
  0 siblings, 1 reply; 4+ messages in thread
From: Avri Altman @ 2019-03-14  9:15 UTC (permalink / raw)
  To: Kangjie Lu
  Cc: pakki001, Vinayak Holikatti, James E.J. Bottomley,
	Martin K. Petersen, linux-scsi, linux-kernel

Hi,
> 
> Signed-off-by: Kangjie Lu <kjlu@umn.edu>
Acked-by: Avri Altman <avri.altman@wdc.com>

> ---
>  drivers/scsi/ufs/ufs-hisi.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/scsi/ufs/ufs-hisi.c b/drivers/scsi/ufs/ufs-hisi.c
> index 452e19f8fb47..ce9d7c40909f 100644
> --- a/drivers/scsi/ufs/ufs-hisi.c
> +++ b/drivers/scsi/ufs/ufs-hisi.c
> @@ -544,6 +544,11 @@ 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__);
Use full line please

> +		return PTR_ERR(host->rst);
> +	}
> 
>  	ufs_hisi_set_pm_lvl(hba);
> 
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2] scsi: ufs: fix a missing check of devm_reset_control_get
  2019-03-14  9:15 ` Avri Altman
@ 2019-03-15  7:11   ` Kangjie Lu
  2019-03-19 18:37     ` Martin K. Petersen
  0 siblings, 1 reply; 4+ messages in thread
From: Kangjie Lu @ 2019-03-15  7:11 UTC (permalink / raw)
  To: kjlu
  Cc: pakki001, Vinayak Holikatti, James E.J. Bottomley,
	Martin K. Petersen, linux-scsi, linux-kernel

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(+)

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);
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] scsi: ufs: fix a missing check of devm_reset_control_get
  2019-03-15  7:11   ` [PATCH v2] " Kangjie Lu
@ 2019-03-19 18:37     ` Martin K. Petersen
  0 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2019-03-19 18:37 UTC (permalink / raw)
  To: Kangjie Lu
  Cc: pakki001, Vinayak Holikatti, James E.J. Bottomley,
	Martin K. Petersen, linux-scsi, linux-kernel


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.

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-03-19 18:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-14  6:37 [PATCH] scsi: ufs: fix a missing check of devm_reset_control_get Kangjie Lu
2019-03-14  9:15 ` Avri Altman
2019-03-15  7:11   ` [PATCH v2] " Kangjie Lu
2019-03-19 18:37     ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).