[PATCH] drm/kmb: Use common error handling code in kmb_probe()

Markus Elfring posted 1 patch 1 month, 3 weeks ago
drivers/gpu/drm/kmb/kmb_drv.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
[PATCH] drm/kmb: Use common error handling code in kmb_probe()
Posted by Markus Elfring 1 month, 3 weeks ago
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 3 Oct 2024 13:20:05 +0200

Add a label so that a bit of exception handling can be better reused
in a subsequent if branch of this function implementation.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/gpu/drm/kmb/kmb_drv.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/kmb/kmb_drv.c b/drivers/gpu/drm/kmb/kmb_drv.c
index 169b83987ce2..2680afa684a2 100644
--- a/drivers/gpu/drm/kmb/kmb_drv.c
+++ b/drivers/gpu/drm/kmb/kmb_drv.c
@@ -498,16 +498,16 @@ static int kmb_probe(struct platform_device *pdev)
 	}
 	dsi_node = of_graph_get_remote_port_parent(dsi_in);
 	if (!dsi_node) {
-		of_node_put(dsi_in);
 		DRM_ERROR("Failed to get dsi node from DT\n");
-		return -EINVAL;
+		goto err_put_dsi_in;
 	}

 	dsi_pdev = of_find_device_by_node(dsi_node);
 	if (!dsi_pdev) {
-		of_node_put(dsi_in);
 		of_node_put(dsi_node);
 		DRM_ERROR("Failed to get dsi platform device\n");
+err_put_dsi_in:
+		of_node_put(dsi_in);
 		return -EINVAL;
 	}

--
2.46.1