All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] drm/exynos: free DP if probe fails to find a panel or bridge
@ 2014-11-20 23:54 Gustavo Padovan
  2014-11-20 23:54 ` [PATCH 2/3] drm/exynos: avoid race condition when adding a drm component Gustavo Padovan
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Gustavo Padovan @ 2014-11-20 23:54 UTC (permalink / raw)
  To: linux-samsung-soc; +Cc: Gustavo Padovan, dri-devel

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

DP was leaked everytime function returns EPROBE_DEFER, free it before
returning.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/gpu/drm/exynos/exynos_dp_core.c | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c
index 85762cf..6fd4a46 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_core.c
+++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
@@ -1336,8 +1336,10 @@ static int exynos_dp_probe(struct platform_device *pdev)
 	if (panel_node) {
 		dp->panel = of_drm_find_panel(panel_node);
 		of_node_put(panel_node);
-		if (!dp->panel)
-			return -EPROBE_DEFER;
+		if (!dp->panel) {
+			ret = -EPROBE_DEFER;
+			goto free_dp;
+		}
 	}
 
 	endpoint = of_graph_get_next_endpoint(dev->of_node, NULL);
@@ -1346,10 +1348,14 @@ static int exynos_dp_probe(struct platform_device *pdev)
 		if (bridge_node) {
 			dp->bridge = of_drm_find_bridge(bridge_node);
 			of_node_put(bridge_node);
-			if (!dp->bridge)
-				return -EPROBE_DEFER;
-		} else
-			return -EPROBE_DEFER;
+			if (!dp->bridge) {
+				ret = -EPROBE_DEFER;
+				goto free_dp;
+			}
+		} else {
+			ret = -EPROBE_DEFER;
+			goto free_dp;
+		}
 	}
 
 	exynos_dp_display.ctx = dp;
@@ -1359,6 +1365,9 @@ static int exynos_dp_probe(struct platform_device *pdev)
 		exynos_drm_component_del(&pdev->dev,
 						EXYNOS_DEVICE_TYPE_CONNECTOR);
 
+free_dp:
+	devm_kfree(dev, dp);
+
 	return ret;
 }
 
-- 
1.9.3

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2014-11-24 13:02 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-20 23:54 [PATCH 1/3] drm/exynos: free DP if probe fails to find a panel or bridge Gustavo Padovan
2014-11-20 23:54 ` [PATCH 2/3] drm/exynos: avoid race condition when adding a drm component Gustavo Padovan
2014-11-21  6:07   ` Inki Dae
2014-11-21 12:50     ` Gustavo Padovan
2014-11-20 23:54 ` [PATCH 3/3] drm/exynos: avoid leak if exynos_dpi_probe() fails Gustavo Padovan
2014-11-21 17:40 ` [PATCH 1/3] drm/exynos: free DP if probe fails to find a panel or bridge Ajay kumar
2014-11-23  9:22   ` Jingoo Han
2014-11-22 14:56 ` Inki Dae
2014-11-24 13:02   ` Gustavo Padovan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.