drm/mcde: Fix uninitialized variable
authorLinus Walleij <linus.walleij@linaro.org>
Tue, 18 Jun 2019 11:52:45 +0000 (13:52 +0200)
committerLinus Walleij <linus.walleij@linaro.org>
Mon, 24 Jun 2019 22:10:24 +0000 (00:10 +0200)
We need to handle the case when of_drm_find_bridge() returns
NULL.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20190618115245.13915-1-linus.walleij@linaro.org
drivers/gpu/drm/mcde/mcde_drv.c

index a1917e21d53b75e75d2aea44405b2f383dfa3103..982fe8485a617ad4bb4cd66c39c34f61ed07c83e 100644 (file)
@@ -317,7 +317,7 @@ static int mcde_probe(struct platform_device *pdev)
        struct device *dev = &pdev->dev;
        struct drm_device *drm;
        struct mcde *mcde;
-       struct component_match *match;
+       struct component_match *match = NULL;
        struct resource *res;
        u32 pid;
        u32 val;
@@ -483,6 +483,10 @@ static int mcde_probe(struct platform_device *pdev)
                }
                put_device(p);
        }
+       if (!match) {
+               dev_err(dev, "no matching components\n");
+               return -ENODEV;
+       }
        if (IS_ERR(match)) {
                dev_err(dev, "could not create component match\n");
                ret = PTR_ERR(match);