[12/24] drm/omap: Init fbdev emulation only when we have displays

Message ID 1518428694-18018-13-git-send-email-tomi.valkeinen@ti.com
State Superseded
Headers show
Series
  • drm/omap: misc patches
Related show

Commit Message

Tomi Valkeinen Feb. 12, 2018, 9:44 a.m.
From: Peter Ujfalusi <peter.ujfalusi@ti.com>

Do not try to init the fbdev if either num_crtcs or num_connectors is 0.
In this case we do not have display so the fbdev init would fail anyways.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/omap_fbdev.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Laurent Pinchart Feb. 27, 2018, 1:36 p.m. | #1
Hi Tomi,

Thank you for the patch.

On Monday, 12 February 2018 11:44:42 EET Tomi Valkeinen wrote:
> From: Peter Ujfalusi <peter.ujfalusi@ti.com>
> 
> Do not try to init the fbdev if either num_crtcs or num_connectors is 0.
> In this case we do not have display so the fbdev init would fail anyways.
> 
> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

I'd move this earlier in the series with the other fbdev-related patches.

> ---
>  drivers/gpu/drm/omapdrm/omap_fbdev.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c
> b/drivers/gpu/drm/omapdrm/omap_fbdev.c index 30ce3d562414..509283af5b0c
> 100644
> --- a/drivers/gpu/drm/omapdrm/omap_fbdev.c
> +++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c
> @@ -249,6 +249,9 @@ void omap_fbdev_init(struct drm_device *dev)
>  	struct drm_fb_helper *helper;
>  	int ret = 0;
> 
> +	if (!priv->num_crtcs || !priv->num_connectors)
> +		return;
> +
>  	fbdev = kzalloc(sizeof(*fbdev), GFP_KERNEL);
>  	if (!fbdev)
>  		goto fail;

Patch

diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c b/drivers/gpu/drm/omapdrm/omap_fbdev.c
index 30ce3d562414..509283af5b0c 100644
--- a/drivers/gpu/drm/omapdrm/omap_fbdev.c
+++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c
@@ -249,6 +249,9 @@  void omap_fbdev_init(struct drm_device *dev)
 	struct drm_fb_helper *helper;
 	int ret = 0;
 
+	if (!priv->num_crtcs || !priv->num_connectors)
+		return;
+
 	fbdev = kzalloc(sizeof(*fbdev), GFP_KERNEL);
 	if (!fbdev)
 		goto fail;