[v2] drm/mcde: Fix uninitialized variable

Submitted by Linus Walleij on June 18, 2019, 11:52 a.m.

Details

Message ID 20190618115245.13915-1-linus.walleij@linaro.org
State Accepted
Commit ca5be902a87ddccc88144f2dea21b5f0814391ef
Headers show
Series "drm/mcde: Fix uninitialized variable" ( rev: 2 ) in DRI devel

Not browsing as part of any series.

Commit Message

Linus Walleij June 18, 2019, 11:52 a.m.
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>
---
ChangeLog v1->v2:
- Account for both NULL and error pointers by two clauses.
---
 drivers/gpu/drm/mcde/mcde_drv.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/mcde/mcde_drv.c b/drivers/gpu/drm/mcde/mcde_drv.c
index baf63fb6850a..a810568c76df 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,6 +485,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);

Comments

Thanks!

regards,
dan carpenter
On Tue, Jun 18, 2019 at 2:31 PM Dan Carpenter <dan.carpenter@oracle.com> wrote:

> Thanks!

Recording this as Acked-by: when applying.

Yours,
Linus Walleij
On Tue, Jun 25, 2019 at 12:09:54AM +0200, Linus Walleij wrote:
> On Tue, Jun 18, 2019 at 2:31 PM Dan Carpenter <dan.carpenter@oracle.com> wrote:
> 
> > Thanks!
> 
> Recording this as Acked-by: when applying.
> 

That's is an honour for me.  I figured that your Signed-off-by dwarfed
my Ack.  :P

regards,
dan carpenter
On Tue, Jun 25, 2019 at 9:14 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:
> On Tue, Jun 25, 2019 at 12:09:54AM +0200, Linus Walleij wrote:
> > On Tue, Jun 18, 2019 at 2:31 PM Dan Carpenter <dan.carpenter@oracle.com> wrote:
> >
> > > Thanks!
> >
> > Recording this as Acked-by: when applying.
> >
>
> That's is an honour for me.  I figured that your Signed-off-by dwarfed
> my Ack.  :P

Not at all. In DRM we have a rule to not push any changes without
a proper ACK.

Yours,
Linus Walleij