diff options
author | Arnd Bergmann <arnd@arndb.de> | 2016-05-05 16:10:52 -0400 |
---|---|---|
committer | Maxime Ripard <maxime.ripard@free-electrons.com> | 2016-05-30 02:28:33 -0400 |
commit | 9fa2568d9fe0c6dbf3253af6840de9389f4e89cb (patch) | |
tree | bc2d8167845a848f0ef9f73cd637d7ecaac26f54 | |
parent | f1b78f0e759b174ec4f5e3b0dd27a079a2416b66 (diff) |
drm: sun4i: fix probe error handling
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")
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
-rw-r--r-- | drivers/gpu/drm/sun4i/sun4i_dotclock.c | 8 |
1 files 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) | |||
127 | const char *clk_name, *parent_name; | 127 | const char *clk_name, *parent_name; |
128 | struct clk_init_data init; | 128 | struct clk_init_data init; |
129 | struct sun4i_dclk *dclk; | 129 | struct sun4i_dclk *dclk; |
130 | int ret; | ||
130 | 131 | ||
131 | parent_name = __clk_get_name(tcon->sclk0); | 132 | parent_name = __clk_get_name(tcon->sclk0); |
132 | of_property_read_string_index(dev->of_node, "clock-output-names", 0, | 133 | ret = of_property_read_string_index(dev->of_node, |
133 | &clk_name); | 134 | "clock-output-names", 0, |
135 | &clk_name); | ||
136 | if (ret) | ||
137 | return ret; | ||
134 | 138 | ||
135 | dclk = devm_kzalloc(dev, sizeof(*dclk), GFP_KERNEL); | 139 | dclk = devm_kzalloc(dev, sizeof(*dclk), GFP_KERNEL); |
136 | if (!dclk) | 140 | if (!dclk) |