* [PATCH] drm: sun4i: fix probe error handling
@ 2016-05-05 20:10 Arnd Bergmann
2016-05-08 18:05 ` Maxime Ripard
0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2016-05-05 20:10 UTC (permalink / raw)
To: Maxime Ripard, David Airlie, Chen-Yu Tsai
Cc: Arnd Bergmann, Boris Brezillon, dri-devel, linux-arm-kernel,
linux-kernel
gcc points out a possible uninitialized variable use in
sun4i_dclk_create():
drivers/gpu/drm/sun4i/sun4i_dotclock.c: In function 'sun4i_dclk_create':
drivers/gpu/drm/sun4i/sun4i_dotclock.c:139:12: error: 'clk_name' may be used uninitialized in this function [-Werror=maybe-uninitialized]
init.name = clk_name;
The warning only shows up when CONFIG_OF is disabled, and the
property is never filled, but the same bug can show up even
when CONFIG_OF is enabled but of_property_read_string_index
returns another error.
To fix it, this ensures that sun4i_dclk_create propagates
any error from of_property_read_string_index.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 9026e0d122ac ("drm: Add Allwinner A10 Display Engine support")
---
drivers/gpu/drm/sun4i/sun4i_dotclock.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/sun4i/sun4i_dotclock.c b/drivers/gpu/drm/sun4i/sun4i_dotclock.c
index 3ff668cb463c..6c9c090a8006 100644
--- a/drivers/gpu/drm/sun4i/sun4i_dotclock.c
+++ b/drivers/gpu/drm/sun4i/sun4i_dotclock.c
@@ -127,10 +127,14 @@ int sun4i_dclk_create(struct device *dev, struct sun4i_tcon *tcon)
const char *clk_name, *parent_name;
struct clk_init_data init;
struct sun4i_dclk *dclk;
+ int ret;
parent_name = __clk_get_name(tcon->sclk0);
- of_property_read_string_index(dev->of_node, "clock-output-names", 0,
- &clk_name);
+ ret = of_property_read_string_index(dev->of_node,
+ "clock-output-names", 0,
+ &clk_name);
+ if (ret)
+ return ret;
dclk = devm_kzalloc(dev, sizeof(*dclk), GFP_KERNEL);
if (!dclk)
--
2.7.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] drm: sun4i: fix probe error handling
2016-05-05 20:10 [PATCH] drm: sun4i: fix probe error handling Arnd Bergmann
@ 2016-05-08 18:05 ` Maxime Ripard
0 siblings, 0 replies; 2+ messages in thread
From: Maxime Ripard @ 2016-05-08 18:05 UTC (permalink / raw)
To: Arnd Bergmann
Cc: David Airlie, Chen-Yu Tsai, Boris Brezillon, dri-devel,
linux-arm-kernel, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 997 bytes --]
On Thu, May 05, 2016 at 10:10:52PM +0200, Arnd Bergmann wrote:
> gcc points out a possible uninitialized variable use in
> sun4i_dclk_create():
>
> drivers/gpu/drm/sun4i/sun4i_dotclock.c: In function 'sun4i_dclk_create':
> drivers/gpu/drm/sun4i/sun4i_dotclock.c:139:12: error: 'clk_name' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> init.name = clk_name;
>
> The warning only shows up when CONFIG_OF is disabled, and the
> property is never filled, but the same bug can show up even
> when CONFIG_OF is enabled but of_property_read_string_index
> returns another error.
>
> To fix it, this ensures that sun4i_dclk_create propagates
> any error from of_property_read_string_index.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Fixes: 9026e0d122ac ("drm: Add Allwinner A10 Display Engine support")
Applied, thanks
Maxime
--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-05-08 18:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-05 20:10 [PATCH] drm: sun4i: fix probe error handling Arnd Bergmann
2016-05-08 18:05 ` Maxime Ripard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®