diff mbox series

drm/vc4: drv: Avoid possible NPD when booted without KMS

Message ID 20240217150720.33257-1-wahrenst@gmx.net (mailing list archive)
State New, archived
Headers show
Series drm/vc4: drv: Avoid possible NPD when booted without KMS | expand

Commit Message

Stefan Wahren Feb. 17, 2024, 3:07 p.m. UTC
From: Dom Cobley <popcornmix@gmail.com>

In case there is no matching KMS, the function vc4_match_add_driver
won't change the match pointer which is initialized with NULL.
Since component_master_add_with_match doesn't expected match
to be a NULL pointer, this results into a NPD.

Fixes: c8b75bca92cb ("drm/vc4: Add KMS support for Raspberry Pi.")
Signed-off-by: Dom Cobley <popcornmix@gmail.com>
Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
 drivers/gpu/drm/vc4/vc4_drv.c | 2 ++
 1 file changed, 2 insertions(+)

--
2.34.1

Comments

Maxime Ripard Feb. 21, 2024, 3 p.m. UTC | #1
Hi,

On Sat, Feb 17, 2024 at 04:07:20PM +0100, Stefan Wahren wrote:
> From: Dom Cobley <popcornmix@gmail.com>
> 
> In case there is no matching KMS,

Sorry, I'm not sure what a matching KMS is supposed to be here?

> the function vc4_match_add_driver won't change the match pointer which
> is initialized with NULL. Since component_master_add_with_match
> doesn't expected match to be a NULL pointer, this results into a NPD.
> 
> Fixes: c8b75bca92cb ("drm/vc4: Add KMS support for Raspberry Pi.")
> Signed-off-by: Dom Cobley <popcornmix@gmail.com>
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
> ---
>  drivers/gpu/drm/vc4/vc4_drv.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
> index c133e96b8aca..4f17840df9d3 100644
> --- a/drivers/gpu/drm/vc4/vc4_drv.c
> +++ b/drivers/gpu/drm/vc4/vc4_drv.c
> @@ -439,6 +439,8 @@ static int vc4_platform_drm_probe(struct platform_device *pdev)
> 
>  	vc4_match_add_drivers(dev, &match,
>  			      component_drivers, ARRAY_SIZE(component_drivers));
> +	if (!match)
> +		return -ENODEV;

From the looks of it, it would return the pointer to the last matched
driver. I'm not sure how useful it is, but if it's NULL it would mean
that the main brcm,bcm2835-vc4 device would have probed, but not any of
its subdevice? How can that happen?

Maxime
diff mbox series

Patch

diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
index c133e96b8aca..4f17840df9d3 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.c
+++ b/drivers/gpu/drm/vc4/vc4_drv.c
@@ -439,6 +439,8 @@  static int vc4_platform_drm_probe(struct platform_device *pdev)

 	vc4_match_add_drivers(dev, &match,
 			      component_drivers, ARRAY_SIZE(component_drivers));
+	if (!match)
+		return -ENODEV;

 	return component_master_add_with_match(dev, &vc4_drm_ops, match);
 }