[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20190902224132.20787-1-yzhai003@ucr.edu>
Date: Mon, 2 Sep 2019 15:41:32 -0700
From: Yizhuo <yzhai003@....edu>
To: unlisted-recipients:; (no To-header on input)
Cc: csong@...ucr.edu, zhiyunq@...ucr.edu, Yizhuo <yzhai003@....edu>,
MyungJoo Ham <myungjoo.ham@...sung.com>,
Chanwoo Choi <cw00.choi@...sung.com>,
Chen-Yu Tsai <wens@...e.org>,
Hans de Goede <hdegoede@...hat.com>,
linux-kernel@...r.kernel.org
Subject: [PATCH] extcon: axp288: Variable "val" could be uninitialized if regmap_read() fails
In function axp288_extcon_log_rsi(), variable "val" could be
uninitialized if regmap_read() fails. However, it's ued to
decide the control flow later in the if statement, which is
potentially unsafe.
Signed-off-by: Yizhuo <yzhai003@....edu>
---
drivers/extcon/extcon-axp288.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/extcon/extcon-axp288.c b/drivers/extcon/extcon-axp288.c
index 7254852e6ec0..54116a926ab6 100644
--- a/drivers/extcon/extcon-axp288.c
+++ b/drivers/extcon/extcon-axp288.c
@@ -135,6 +135,11 @@ static void axp288_extcon_log_rsi(struct axp288_extcon_info *info)
int ret;
ret = regmap_read(info->regmap, AXP288_PS_BOOT_REASON_REG, &val);
+ if (ret) {
+ dev_err(info->dev, "failed to read AXP288_PS_BOOT_REASON_REG\n");
+ return;
+ }
+
for (i = 0, rsi = axp288_pwr_up_down_info; *rsi; rsi++, i++) {
if (val & BIT(i)) {
dev_dbg(info->dev, "%s\n", *rsi);
--
2.17.1
Powered by blists - more mailing lists