From: Linus Walleij Date: Tue, 18 Jun 2019 11:52:45 +0000 (+0200) Subject: drm/mcde: Fix uninitialized variable X-Git-Tag: for-linus-2019-09-27~66^2~18^2~345 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=ca5be902a87ddccc88144f2dea21b5f0814391ef;p=linux-block.git drm/mcde: Fix uninitialized variable We need to handle the case when of_drm_find_bridge() returns NULL. Reported-by: Dan Carpenter Acked-by: Dan Carpenter Signed-off-by: Linus Walleij Link: https://patchwork.freedesktop.org/patch/msgid/20190618115245.13915-1-linus.walleij@linaro.org --- diff --git a/drivers/gpu/drm/mcde/mcde_drv.c b/drivers/gpu/drm/mcde/mcde_drv.c index a1917e21d53b..982fe8485a61 100644 --- a/drivers/gpu/drm/mcde/mcde_drv.c +++ b/drivers/gpu/drm/mcde/mcde_drv.c @@ -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);