linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/ipuv3/parallel: Fix an error handling path in imx_pd_probe()
@ 2024-09-06 19:47 Christophe JAILLET
  2024-09-09  7:39 ` Jani Nikula
  0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2024-09-06 19:47 UTC (permalink / raw)
  To: Philipp Zabel, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, Jani Nikula
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, Simona Vetter,
	dri-devel, imx, linux-arm-kernel

If component_add() fails, we need to undo a potential previous
drm_edid_alloc() call.

Add an error handling path and the missing drm_edid_free(), as already done
in the reomve function.

Fixes: 42e08287a318 ("drm/ipuv3/parallel: convert to struct drm_edid")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/gpu/drm/imx/ipuv3/parallel-display.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/imx/ipuv3/parallel-display.c b/drivers/gpu/drm/imx/ipuv3/parallel-display.c
index 91d7808a2d8d..6d51203f7f0f 100644
--- a/drivers/gpu/drm/imx/ipuv3/parallel-display.c
+++ b/drivers/gpu/drm/imx/ipuv3/parallel-display.c
@@ -350,7 +350,15 @@ static int imx_pd_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, imxpd);
 
-	return component_add(dev, &imx_pd_ops);
+	ret = component_add(dev, &imx_pd_ops);
+	if (ret)
+		goto free_edid;
+
+	return 0;
+
+free_edid:
+	drm_edid_free(imxpd->drm_edid);
+	return ret;
 }
 
 static void imx_pd_remove(struct platform_device *pdev)
-- 
2.46.0



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

* Re: [PATCH] drm/ipuv3/parallel: Fix an error handling path in imx_pd_probe()
  2024-09-06 19:47 [PATCH] drm/ipuv3/parallel: Fix an error handling path in imx_pd_probe() Christophe JAILLET
@ 2024-09-09  7:39 ` Jani Nikula
  0 siblings, 0 replies; 2+ messages in thread
From: Jani Nikula @ 2024-09-09  7:39 UTC (permalink / raw)
  To: Christophe JAILLET, Philipp Zabel, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, Simona Vetter,
	dri-devel, imx, linux-arm-kernel

On Fri, 06 Sep 2024, Christophe JAILLET <christophe.jaillet@wanadoo.fr> wrote:
> If component_add() fails, we need to undo a potential previous
> drm_edid_alloc() call.
>
> Add an error handling path and the missing drm_edid_free(), as already done
> in the reomve function.

See commit fe30fabf229f ("drm/imx: parallel-display: drop edid override
support").

BR,
Jani.


>
> Fixes: 42e08287a318 ("drm/ipuv3/parallel: convert to struct drm_edid")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
>  drivers/gpu/drm/imx/ipuv3/parallel-display.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/imx/ipuv3/parallel-display.c b/drivers/gpu/drm/imx/ipuv3/parallel-display.c
> index 91d7808a2d8d..6d51203f7f0f 100644
> --- a/drivers/gpu/drm/imx/ipuv3/parallel-display.c
> +++ b/drivers/gpu/drm/imx/ipuv3/parallel-display.c
> @@ -350,7 +350,15 @@ static int imx_pd_probe(struct platform_device *pdev)
>  
>  	platform_set_drvdata(pdev, imxpd);
>  
> -	return component_add(dev, &imx_pd_ops);
> +	ret = component_add(dev, &imx_pd_ops);
> +	if (ret)
> +		goto free_edid;
> +
> +	return 0;
> +
> +free_edid:
> +	drm_edid_free(imxpd->drm_edid);
> +	return ret;
>  }
>  
>  static void imx_pd_remove(struct platform_device *pdev)

-- 
Jani Nikula, Intel


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

end of thread, other threads:[~2024-09-09  7:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-06 19:47 [PATCH] drm/ipuv3/parallel: Fix an error handling path in imx_pd_probe() Christophe JAILLET
2024-09-09  7:39 ` Jani Nikula

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).