mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drm/imx: dw_hdmi-imx: Fix bailout in error cases of probe
@ 2022-01-28  9:19 Liu Ying
  2022-02-25  3:06 ` Liu Ying
  2022-03-29 16:41 ` Philipp Zabel
  0 siblings, 2 replies; 3+ messages in thread
From: Liu Ying @ 2022-01-28  9:19 UTC (permalink / raw)
  To: dri-devel, linux-arm-kernel, linux-kernel
  Cc: Philipp Zabel, David Airlie, Daniel Vetter, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team

In dw_hdmi_imx_probe(), if error happens after dw_hdmi_probe() returns
successfully, dw_hdmi_remove() should be called where necessary as
bailout.

Fixes: c805ec7eb210 ("drm/imx: dw_hdmi-imx: move initialization into probe")
Cc: Philipp Zabel <p.zabel@pengutronix.de>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: NXP Linux Team <linux-imx@nxp.com>
Signed-off-by: Liu Ying <victor.liu@nxp.com>
---
 drivers/gpu/drm/imx/dw_hdmi-imx.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/imx/dw_hdmi-imx.c b/drivers/gpu/drm/imx/dw_hdmi-imx.c
index 87428fb23d9f..a2277a0d6d06 100644
--- a/drivers/gpu/drm/imx/dw_hdmi-imx.c
+++ b/drivers/gpu/drm/imx/dw_hdmi-imx.c
@@ -222,6 +222,7 @@ static int dw_hdmi_imx_probe(struct platform_device *pdev)
 	struct device_node *np = pdev->dev.of_node;
 	const struct of_device_id *match = of_match_node(dw_hdmi_imx_dt_ids, np);
 	struct imx_hdmi *hdmi;
+	int ret;
 
 	hdmi = devm_kzalloc(&pdev->dev, sizeof(*hdmi), GFP_KERNEL);
 	if (!hdmi)
@@ -243,10 +244,15 @@ static int dw_hdmi_imx_probe(struct platform_device *pdev)
 	hdmi->bridge = of_drm_find_bridge(np);
 	if (!hdmi->bridge) {
 		dev_err(hdmi->dev, "Unable to find bridge\n");
+		dw_hdmi_remove(hdmi->hdmi);
 		return -ENODEV;
 	}
 
-	return component_add(&pdev->dev, &dw_hdmi_imx_ops);
+	ret = component_add(&pdev->dev, &dw_hdmi_imx_ops);
+	if (ret)
+		dw_hdmi_remove(hdmi->hdmi);
+
+	return ret;
 }
 
 static int dw_hdmi_imx_remove(struct platform_device *pdev)
-- 
2.25.1


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

* Re: [PATCH] drm/imx: dw_hdmi-imx: Fix bailout in error cases of probe
  2022-01-28  9:19 [PATCH] drm/imx: dw_hdmi-imx: Fix bailout in error cases of probe Liu Ying
@ 2022-02-25  3:06 ` Liu Ying
  2022-03-29 16:41 ` Philipp Zabel
  1 sibling, 0 replies; 3+ messages in thread
From: Liu Ying @ 2022-02-25  3:06 UTC (permalink / raw)
  To: dri-devel, linux-arm-kernel, linux-kernel
  Cc: Philipp Zabel, David Airlie, Daniel Vetter, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team

Hi Philipp,

On Fri, 2022-01-28 at 17:19 +0800, Liu Ying wrote:
> In dw_hdmi_imx_probe(), if error happens after dw_hdmi_probe() returns
> successfully, dw_hdmi_remove() should be called where necessary as
> bailout.
> 
> Fixes: c805ec7eb210 ("drm/imx: dw_hdmi-imx: move initialization into probe")
> Cc: Philipp Zabel <p.zabel@pengutronix.de>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Shawn Guo <shawnguo@kernel.org>
> Cc: Sascha Hauer <s.hauer@pengutronix.de>
> Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
> Cc: Fabio Estevam <festevam@gmail.com>
> Cc: NXP Linux Team <linux-imx@nxp.com>
> Signed-off-by: Liu Ying <victor.liu@nxp.com>

Any comments?  Can you please pick this up?

Regards,
Liu Ying

> ---
>  drivers/gpu/drm/imx/dw_hdmi-imx.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/imx/dw_hdmi-imx.c b/drivers/gpu/drm/imx/dw_hdmi-imx.c
> index 87428fb23d9f..a2277a0d6d06 100644
> --- a/drivers/gpu/drm/imx/dw_hdmi-imx.c
> +++ b/drivers/gpu/drm/imx/dw_hdmi-imx.c
> @@ -222,6 +222,7 @@ static int dw_hdmi_imx_probe(struct platform_device *pdev)
>  	struct device_node *np = pdev->dev.of_node;
>  	const struct of_device_id *match = of_match_node(dw_hdmi_imx_dt_ids, np);
>  	struct imx_hdmi *hdmi;
> +	int ret;
>  
>  	hdmi = devm_kzalloc(&pdev->dev, sizeof(*hdmi), GFP_KERNEL);
>  	if (!hdmi)
> @@ -243,10 +244,15 @@ static int dw_hdmi_imx_probe(struct platform_device *pdev)
>  	hdmi->bridge = of_drm_find_bridge(np);
>  	if (!hdmi->bridge) {
>  		dev_err(hdmi->dev, "Unable to find bridge\n");
> +		dw_hdmi_remove(hdmi->hdmi);
>  		return -ENODEV;
>  	}
>  
> -	return component_add(&pdev->dev, &dw_hdmi_imx_ops);
> +	ret = component_add(&pdev->dev, &dw_hdmi_imx_ops);
> +	if (ret)
> +		dw_hdmi_remove(hdmi->hdmi);
> +
> +	return ret;
>  }
>  
>  static int dw_hdmi_imx_remove(struct platform_device *pdev)


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

* Re: [PATCH] drm/imx: dw_hdmi-imx: Fix bailout in error cases of probe
  2022-01-28  9:19 [PATCH] drm/imx: dw_hdmi-imx: Fix bailout in error cases of probe Liu Ying
  2022-02-25  3:06 ` Liu Ying
@ 2022-03-29 16:41 ` Philipp Zabel
  1 sibling, 0 replies; 3+ messages in thread
From: Philipp Zabel @ 2022-03-29 16:41 UTC (permalink / raw)
  To: Liu Ying, dri-devel, linux-arm-kernel, linux-kernel
  Cc: David Airlie, Daniel Vetter, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team

On Fr, 2022-01-28 at 17:19 +0800, Liu Ying wrote:
> In dw_hdmi_imx_probe(), if error happens after dw_hdmi_probe()
> returns
> successfully, dw_hdmi_remove() should be called where necessary as
> bailout.
> 
> Fixes: c805ec7eb210 ("drm/imx: dw_hdmi-imx: move initialization into
> probe")
> Cc: Philipp Zabel <p.zabel@pengutronix.de>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Shawn Guo <shawnguo@kernel.org>
> Cc: Sascha Hauer <s.hauer@pengutronix.de>
> Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
> Cc: Fabio Estevam <festevam@gmail.com>
> Cc: NXP Linux Team <linux-imx@nxp.com>
> Signed-off-by: Liu Ying <victor.liu@nxp.com>
> ---
>  drivers/gpu/drm/imx/dw_hdmi-imx.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/imx/dw_hdmi-imx.c
> b/drivers/gpu/drm/imx/dw_hdmi-imx.c
> index 87428fb23d9f..a2277a0d6d06 100644
> --- a/drivers/gpu/drm/imx/dw_hdmi-imx.c
> +++ b/drivers/gpu/drm/imx/dw_hdmi-imx.c
> @@ -222,6 +222,7 @@ static int dw_hdmi_imx_probe(struct
> platform_device *pdev)
>         struct device_node *np = pdev->dev.of_node;
>         const struct of_device_id *match =
> of_match_node(dw_hdmi_imx_dt_ids, np);
>         struct imx_hdmi *hdmi;
> +       int ret;
>  
>         hdmi = devm_kzalloc(&pdev->dev, sizeof(*hdmi), GFP_KERNEL);
>         if (!hdmi)
> @@ -243,10 +244,15 @@ static int dw_hdmi_imx_probe(struct
> platform_device *pdev)
>         hdmi->bridge = of_drm_find_bridge(np);
>         if (!hdmi->bridge) {
>                 dev_err(hdmi->dev, "Unable to find bridge\n");
> +               dw_hdmi_remove(hdmi->hdmi);
>                 return -ENODEV;
>         }
>  
> -       return component_add(&pdev->dev, &dw_hdmi_imx_ops);
> +       ret = component_add(&pdev->dev, &dw_hdmi_imx_ops);
> +       if (ret)
> +               dw_hdmi_remove(hdmi->hdmi);
> +
> +       return ret;
>  }
>  
>  static int dw_hdmi_imx_remove(struct platform_device *pdev)

Thank you, applied to imx-drm/fixes.

regards
Philipp

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

end of thread, other threads:[~2022-03-29 16:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-28  9:19 [PATCH] drm/imx: dw_hdmi-imx: Fix bailout in error cases of probe Liu Ying
2022-02-25  3:06 ` Liu Ying
2022-03-29 16:41 ` Philipp Zabel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®