]>
Commit | Line | Data |
---|---|---|
ecf3b270 SL |
1 | From 5f0c86d5d7b744561bc3fc73aca8cae7a827398a 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 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, ®); | |
38 | + ret = regmap_read(omap4_dsi_mux_syscon, | |
39 | + OMAP4_DSIPHY_SYSCON_OFFSET, | |
40 | + ®); | |
41 | + if (ret) | |
42 | + return ret; | |
43 | ||
44 | reg &= ~enable_mask; | |
45 | reg &= ~pipd_mask; | |
46 | -- | |
47 | 2.19.1 | |
48 |