[PATCH] drm/rockchip: Fix an error handling path rockchip_dp_probe()

Christophe JAILLET posted 1 patch 3 years, 10 months ago
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
[PATCH] drm/rockchip: Fix an error handling path rockchip_dp_probe()
Posted by Christophe JAILLET 3 years, 10 months ago
Should component_add() fail, we should call analogix_dp_remove() in the
error handling path, as already done in the remove function.

Fixes: 152cce0006ab ("drm/bridge: analogix_dp: Split bind() into probe() and real bind()")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
index 70be64ca0a00..ad2d3ae7e621 100644
--- a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
+++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
@@ -408,7 +408,15 @@ static int rockchip_dp_probe(struct platform_device *pdev)
 	if (IS_ERR(dp->adp))
 		return PTR_ERR(dp->adp);
 
-	return component_add(dev, &rockchip_dp_component_ops);
+	ret = component_add(dev, &rockchip_dp_component_ops);
+	if (ret)
+		goto err_dp_remove;
+
+	return 0;
+
+err_dp_remove:
+	analogix_dp_remove(dp->adp);
+	return ret;
 }
 
 static int rockchip_dp_remove(struct platform_device *pdev)
-- 
2.34.1
Re: [PATCH] drm/rockchip: Fix an error handling path rockchip_dp_probe()
Posted by Heiko Stuebner 3 years, 9 months ago
On Sat, 18 Jun 2022 19:08:05 +0200, Christophe JAILLET wrote:
> Should component_add() fail, we should call analogix_dp_remove() in the
> error handling path, as already done in the remove function.

Applied, thanks!

[1/1] drm/rockchip: Fix an error handling path rockchip_dp_probe()
      commit: 5074376822fe99fa4ce344b851c5016d00c0444f

Best regards,
-- 
Heiko Stuebner <heiko@sntech.de>