[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20190128225524.14865-1-yzhai003@ucr.edu>
Date: Mon, 28 Jan 2019 14:55:24 -0800
From: Yizhuo <yzhai003@....edu>
To: unlisted-recipients:; (no To-header on input)
Cc: csong@...ucr.edu, zhiyunq@...ucr.edu, Yizhuo <yzhai003@....edu>,
Philipp Zabel <p.zabel@...gutronix.de>,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: [PATCH] gpu: ipu-v3: Variable "val" in function ipu_prg_get_pre() could be uninitialized
In function ipu_prg_get_pre(), local variable "val" could
be uninitialized if function regmap_read() returns -EINVAL.
However, this value is used in if statement. This is
potentially unsafe.
Signed-off-by: Yizhuo <yzhai003@....edu>
---
drivers/gpu/ipu-v3/ipu-prg.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/ipu-v3/ipu-prg.c b/drivers/gpu/ipu-v3/ipu-prg.c
index 0013ca9f72c8..df12777d9be7 100644
--- a/drivers/gpu/ipu-v3/ipu-prg.c
+++ b/drivers/gpu/ipu-v3/ipu-prg.c
@@ -210,6 +210,7 @@ static int ipu_prg_get_pre(struct ipu_prg *prg, int prg_chan)
if (!ret) {
u32 val, mux;
int shift;
+ int err;
prg->chan[prg_chan].used_pre = i;
@@ -221,7 +222,12 @@ static int ipu_prg_get_pre(struct ipu_prg *prg, int prg_chan)
/* check other mux, must not point to same channel */
shift = (i == 1) ? 14 : 12;
- regmap_read(prg->iomuxc_gpr, IOMUXC_GPR5, &val);
+ err = regmap_read(prg->iomuxc_gpr, IOMUXC_GPR5, &val);
+ if (err < 0) {
+ dev_err(prg->dev, "read IOMUXC_GPRS failed\n");
+ return err;
+ }
+
if (((val >> shift) & 0x3) == mux) {
regmap_update_bits(prg->iomuxc_gpr, IOMUXC_GPR5,
0x3 << shift,
--
2.17.1
Powered by blists - more mailing lists