]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.14.108/arm-omap2-variable-reg-in-function-omap4_dsi_mux_pad.patch
Linux 4.14.108
[thirdparty/kernel/stable-queue.git] / releases / 4.14.108 / arm-omap2-variable-reg-in-function-omap4_dsi_mux_pad.patch
CommitLineData
ecf3b270
SL
1From 5f0c86d5d7b744561bc3fc73aca8cae7a827398a Mon Sep 17 00:00:00 2001
2From: Yizhuo <yzhai003@ucr.edu>
3Date: Fri, 25 Jan 2019 22:32:20 -0800
4Subject: ARM: OMAP2+: Variable "reg" in function omap4_dsi_mux_pads() could be
5 uninitialized
6
7[ Upstream commit dc30e70391376ba3987aeb856ae6d9c0706534f1 ]
8
9In function omap4_dsi_mux_pads(), local variable "reg" could
10be uninitialized if function regmap_read() returns -EINVAL.
11However, it will be used directly in the later context, which
12is potentially unsafe.
13
14Signed-off-by: Yizhuo <yzhai003@ucr.edu>
15Signed-off-by: Tony Lindgren <tony@atomide.com>
16Signed-off-by: Sasha Levin <sashal@kernel.org>
17---
18 arch/arm/mach-omap2/display.c | 7 ++++++-
19 1 file changed, 6 insertions(+), 1 deletion(-)
20
21diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
22index b3f6eb5d04a2..6e7440ef503a 100644
23--- a/arch/arm/mach-omap2/display.c
24+++ b/arch/arm/mach-omap2/display.c
25@@ -84,6 +84,7 @@ static int omap4_dsi_mux_pads(int dsi_id, unsigned lanes)
26 u32 enable_mask, enable_shift;
27 u32 pipd_mask, pipd_shift;
28 u32 reg;
29+ int ret;
30
31 if (dsi_id == 0) {
32 enable_mask = OMAP4_DSI1_LANEENABLE_MASK;
33@@ -99,7 +100,11 @@ static int omap4_dsi_mux_pads(int dsi_id, unsigned lanes)
34 return -ENODEV;
35 }
36
37- regmap_read(omap4_dsi_mux_syscon, OMAP4_DSIPHY_SYSCON_OFFSET, &reg);
38+ ret = regmap_read(omap4_dsi_mux_syscon,
39+ OMAP4_DSIPHY_SYSCON_OFFSET,
40+ &reg);
41+ if (ret)
42+ return ret;
43
44 reg &= ~enable_mask;
45 reg &= ~pipd_mask;
46--
472.19.1
48