linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/mcde: Fix uninitialized variable
@ 2019-06-12 13:30 Linus Walleij
  2019-06-12 13:40 ` Dan Carpenter
  0 siblings, 1 reply; 2+ messages in thread
From: Linus Walleij @ 2019-06-12 13:30 UTC (permalink / raw)
  To: dri-devel, Maarten Lankhorst, Maxime Ripard, Sean Paul
  Cc: Linus Walleij, Dan Carpenter, linux-arm-kernel

We need to handle the case when of_drm_find_bridge() returns
NULL.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/gpu/drm/mcde/mcde_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/mcde/mcde_drv.c b/drivers/gpu/drm/mcde/mcde_drv.c
index baf63fb6850a..bc11c446e594 100644
--- a/drivers/gpu/drm/mcde/mcde_drv.c
+++ b/drivers/gpu/drm/mcde/mcde_drv.c
@@ -319,7 +319,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;
@@ -485,7 +485,7 @@ static int mcde_probe(struct platform_device *pdev)
 		}
 		put_device(p);
 	}
-	if (IS_ERR(match)) {
+	if (IS_ERR_OR_NULL(match)) {
 		dev_err(dev, "could not create component match\n");
 		ret = PTR_ERR(match);
 		goto clk_disable;
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/mcde: Fix uninitialized variable
  2019-06-12 13:30 [PATCH] drm/mcde: Fix uninitialized variable Linus Walleij
@ 2019-06-12 13:40 ` Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2019-06-12 13:40 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Maxime Ripard, Sean Paul, Maarten Lankhorst, linux-arm-kernel, dri-devel

On Wed, Jun 12, 2019 at 03:30:38PM +0200, Linus Walleij wrote:
> We need to handle the case when of_drm_find_bridge() returns
> NULL.
> 
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Cc: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  drivers/gpu/drm/mcde/mcde_drv.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/mcde/mcde_drv.c b/drivers/gpu/drm/mcde/mcde_drv.c
> index baf63fb6850a..bc11c446e594 100644
> --- a/drivers/gpu/drm/mcde/mcde_drv.c
> +++ b/drivers/gpu/drm/mcde/mcde_drv.c
> @@ -319,7 +319,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;
> @@ -485,7 +485,7 @@ static int mcde_probe(struct platform_device *pdev)
>  		}
>  		put_device(p);
>  	}
> -	if (IS_ERR(match)) {
> +	if (IS_ERR_OR_NULL(match)) {
>  		dev_err(dev, "could not create component match\n");
>  		ret = PTR_ERR(match);

This doesn't work.  If "match" is NULL then "ret" is zero which is
success.

>  		goto clk_disable;

regards,
dan carpenter

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-06-12 13:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-12 13:30 [PATCH] drm/mcde: Fix uninitialized variable Linus Walleij
2019-06-12 13:40 ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).