[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210305084718.12108-1-baijiaju1990@gmail.com>
Date: Fri, 5 Mar 2021 00:47:18 -0800
From: Jia-Ju Bai <baijiaju1990@...il.com>
To: alim.akhtar@...sung.com, avri.altman@....com, jejb@...ux.ibm.com,
martin.petersen@...cle.com, beanhuo@...ron.com,
stanley.chu@...iatek.com, cang@...eaurora.org,
tomas.winkler@...el.com
Cc: linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org,
Jia-Ju Bai <baijiaju1990@...il.com>
Subject: [PATCH] scsi: ufs: fix error return code of ufshcd_populate_vreg()
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@...nghua.edu.cn>
Signed-off-by: Jia-Ju Bai <baijiaju1990@...il.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
Powered by blists - more mailing lists