[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1506689959-7858-2-git-send-email-benjamin.gaignard@linaro.org>
Date: Fri, 29 Sep 2017 14:59:17 +0200
From: Benjamin Gaignard <benjamin.gaignard@...aro.org>
To: architt@...eaurora.org, a.hajda@...sung.com,
Laurent.pinchart@...asonboard.com, airlied@...ux.ie,
daniel.vetter@...el.com, jani.nikula@...ux.intel.com,
seanpaul@...omium.org, yannick.fertre@...com, philippe.cornu@...com
Cc: dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
Benjamin Gaignard <benjamin.gaignard@...aro.org>
Subject: [PATCH 1/3] drm/bridge: make drm_panel_bridge_remove more robust
Make sure that bridge parameter is not NULL and can be safely
cast into a panel_bridge structure.
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@...aro.org>
---
drivers/gpu/drm/bridge/panel.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/bridge/panel.c b/drivers/gpu/drm/bridge/panel.c
index e0cca19..6d99d4a 100644
--- a/drivers/gpu/drm/bridge/panel.c
+++ b/drivers/gpu/drm/bridge/panel.c
@@ -188,7 +188,15 @@ EXPORT_SYMBOL(drm_panel_bridge_add);
*/
void drm_panel_bridge_remove(struct drm_bridge *bridge)
{
- struct panel_bridge *panel_bridge = drm_bridge_to_panel_bridge(bridge);
+ struct panel_bridge *panel_bridge;
+
+ if (!bridge)
+ return;
+
+ if (bridge->funcs != &panel_bridge_bridge_funcs)
+ return;
+
+ panel_bridge = drm_bridge_to_panel_bridge(bridge);
drm_bridge_remove(bridge);
devm_kfree(panel_bridge->panel->dev, bridge);
--
2.7.4
Powered by blists - more mailing lists