* [PATCH] scsi: ufs: fix error return code of ufshcd_populate_vreg()
@ 2021-03-05 8:47 Jia-Ju Bai
2021-03-07 6:41 ` Avri Altman
0 siblings, 1 reply; 2+ messages in thread
From: Jia-Ju Bai @ 2021-03-05 8:47 UTC (permalink / raw)
To: alim.akhtar, avri.altman, jejb, martin.petersen, beanhuo,
stanley.chu, cang, tomas.winkler
Cc: linux-scsi, linux-kernel, Jia-Ju Bai
When np is NULL or of_parse_phandle() returns NULL, no error return code
of ufshcd_populate_vreg() is assigned.
To fix this bug, ret is assigned with -EINVAL or -ENOENT as error return
code.
Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
---
drivers/scsi/ufs/ufshcd-pltfrm.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/scsi/ufs/ufshcd-pltfrm.c b/drivers/scsi/ufs/ufshcd-pltfrm.c
index 1a69949a4ea1..9f11c416a919 100644
--- a/drivers/scsi/ufs/ufshcd-pltfrm.c
+++ b/drivers/scsi/ufs/ufshcd-pltfrm.c
@@ -113,6 +113,7 @@ static int ufshcd_populate_vreg(struct device *dev, const char *name,
if (!np) {
dev_err(dev, "%s: non DT initialization\n", __func__);
+ ret = -EINVAL;
goto out;
}
@@ -120,6 +121,7 @@ static int ufshcd_populate_vreg(struct device *dev, const char *name,
if (!of_parse_phandle(np, prop_name, 0)) {
dev_info(dev, "%s: Unable to find %s regulator, assuming enabled\n",
__func__, prop_name);
+ ret = -ENOENT;
goto out;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* RE: [PATCH] scsi: ufs: fix error return code of ufshcd_populate_vreg()
2021-03-05 8:47 [PATCH] scsi: ufs: fix error return code of ufshcd_populate_vreg() Jia-Ju Bai
@ 2021-03-07 6:41 ` Avri Altman
0 siblings, 0 replies; 2+ messages in thread
From: Avri Altman @ 2021-03-07 6:41 UTC (permalink / raw)
To: Jia-Ju Bai, alim.akhtar, jejb, martin.petersen, beanhuo,
stanley.chu, cang, tomas.winkler
Cc: linux-scsi, linux-kernel
>
> When np is NULL or of_parse_phandle() returns NULL, no error return code
> of ufshcd_populate_vreg() is assigned.
> To fix this bug, ret is assigned with -EINVAL or -ENOENT as error return
> code.
This changes the flow of ufshcd_parse_regulator_info so you need to:
a) get a tested-by tag and indicate which platform & devices you used, and
b) explain further why ufshcd_parse_regulator_info doesn't no longer allow
some of the regulators not to be set via DT, which is the current state.
Thanks,
Avri
>
> Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
> ---
> drivers/scsi/ufs/ufshcd-pltfrm.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/scsi/ufs/ufshcd-pltfrm.c b/drivers/scsi/ufs/ufshcd-pltfrm.c
> index 1a69949a4ea1..9f11c416a919 100644
> --- a/drivers/scsi/ufs/ufshcd-pltfrm.c
> +++ b/drivers/scsi/ufs/ufshcd-pltfrm.c
> @@ -113,6 +113,7 @@ static int ufshcd_populate_vreg(struct device *dev,
> const char *name,
>
> if (!np) {
> dev_err(dev, "%s: non DT initialization\n", __func__);
> + ret = -EINVAL;
> goto out;
> }
>
> @@ -120,6 +121,7 @@ static int ufshcd_populate_vreg(struct device *dev,
> const char *name,
> if (!of_parse_phandle(np, prop_name, 0)) {
> dev_info(dev, "%s: Unable to find %s regulator, assuming enabled\n",
> __func__, prop_name);
> + ret = -ENOENT;
> goto out;
> }
>
> --
> 2.17.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-03-07 6:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-05 8:47 [PATCH] scsi: ufs: fix error return code of ufshcd_populate_vreg() Jia-Ju Bai
2021-03-07 6:41 ` Avri Altman
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).