diff mbox

drm: of: always initialize panel in drm_of_find_panel_or_bridge()

Message ID 20170925103038.lvr5msjvekwczctn@mwanda (mailing list archive)
State New, archived
Headers show

Commit Message

Dan Carpenter Sept. 25, 2017, 10:30 a.m. UTC
The callers expect "panel" to be initialized, but that isn't true if we
return -ENODEV.  It causes bugs like:

    drivers/gpu/drm/tve200/tve200_drv.c:83 tve200_modeset_init()
    error: uninitialized symbol 'panel'.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Comments

Linus Walleij Sept. 25, 2017, 3:34 p.m. UTC | #1
On Mon, Sep 25, 2017 at 12:30 PM, Dan Carpenter
<dan.carpenter@oracle.com> wrote:

> The callers expect "panel" to be initialized, but that isn't true if we
> return -ENODEV.  It causes bugs like:
>
>     drivers/gpu/drm/tve200/tve200_drv.c:83 tve200_modeset_init()
>     error: uninitialized symbol 'panel'.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

I am travelling right now but will apply the patch on monday in
one week from now.

Yours,
Linus Walleij
Linus Walleij Sept. 30, 2017, 11:32 p.m. UTC | #2
On Mon, Sep 25, 2017 at 12:30 PM, Dan Carpenter
<dan.carpenter@oracle.com> wrote:

> The callers expect "panel" to be initialized, but that isn't true if we
> return -ENODEV.  It causes bugs like:
>
>     drivers/gpu/drm/tve200/tve200_drv.c:83 tve200_modeset_init()
>     error: uninitialized symbol 'panel'.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Patch applied.

Yours,
Linus Walleij
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c
index 8dafbdfcd2ea..4c191c050e7d 100644
--- a/drivers/gpu/drm/drm_of.c
+++ b/drivers/gpu/drm/drm_of.c
@@ -233,6 +233,8 @@  int drm_of_find_panel_or_bridge(const struct device_node *np,
 
 	if (!panel && !bridge)
 		return -EINVAL;
+	if (panel)
+		*panel = NULL;
 
 	remote = of_graph_get_remote_node(np, port, endpoint);
 	if (!remote)