[PATCH] gpu: ipu-v3: Variable "val" in function ipu_prg_get_pre() could be uninitialized

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxx>
---
 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

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux