[bug report] drm/mcde: Add new driver for ST-Ericsson MCDE

Linus Walleij linus.walleij at linaro.org
Wed May 29 14:05:53 UTC 2019


On Wed, May 29, 2019 at 1:32 PM Dan Carpenter <dan.carpenter at oracle.com> wrote:

>         drivers/gpu/drm/mcde/mcde_drv.c:488 mcde_probe()
>         error: uninitialized symbol 'match'.
(...)
>    480                  while ((d = bus_find_device(&platform_bus_type, p, drv,
>    481                                              (void *)platform_bus_type.match))) {
>                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> The concern would be that this condintion is never met.  I suspet that's
> not possible?

Component drivers have this property, they rely on the subcomponents to
be there for the functional whole to work. If it's not, all hell break loose in
different ways. So at least one subcomponent (DSI in this case) needs
to be found.

But it's fine to initialize match to NULL if it makes the static checks
happier!

But that just masks the deeper problem, which I found in the qcom
driver: component_master_add_with_match() can be called
with match set to NULL, which it actually cannot handle.
This is a generic problem in DRM and needs to be fixed everywhere.

I made a patch like this:

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;

But I need to test that on real hardware before I submit it.

Thanks,
Linus Walleij


More information about the dri-devel mailing list