]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.19.31/arm-omap2-variable-reg-in-function-omap4_dsi_mux_pad.patch
Linux 4.19.31
[thirdparty/kernel/stable-queue.git] / releases / 4.19.31 / arm-omap2-variable-reg-in-function-omap4_dsi_mux_pad.patch
1 From 78db7670892ab5c82d4fc4c1ebf2f1db1691a679 Mon Sep 17 00:00:00 2001
2 From: Yizhuo <yzhai003@ucr.edu>
3 Date: Fri, 25 Jan 2019 22:32:20 -0800
4 Subject: ARM: OMAP2+: Variable "reg" in function omap4_dsi_mux_pads() could be
5 uninitialized
6
7 [ Upstream commit dc30e70391376ba3987aeb856ae6d9c0706534f1 ]
8
9 In function omap4_dsi_mux_pads(), local variable "reg" could
10 be uninitialized if function regmap_read() returns -EINVAL.
11 However, it will be used directly in the later context, which
12 is potentially unsafe.
13
14 Signed-off-by: Yizhuo <yzhai003@ucr.edu>
15 Signed-off-by: Tony Lindgren <tony@atomide.com>
16 Signed-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
21 diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
22 index 9500b6e27380..5d73f2c0b117 100644
23 --- a/arch/arm/mach-omap2/display.c
24 +++ b/arch/arm/mach-omap2/display.c
25 @@ -83,6 +83,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 @@ -98,7 +99,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 --
47 2.19.1
48