aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbenjamin.gaignard@linaro.org <benjamin.gaignard@linaro.org>2017-10-02 11:32:31 +0200
committerBenjamin Gaignard <benjamin.gaignard@linaro.org>2017-10-10 11:32:35 +0200
commit6b0e284cfa3898109f9f4c9fa6541caa027a3635 (patch)
tree6a3b36d9b5f1c81e24ac97a11392b13756a3401e
parentf8e0731db4a02c8c5624e1dce6dc983210a51f64 (diff)
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@linaro.org> Reviewed-by: Philippe Cornu <philippe.cornu@st.com> Tested-by: Philippe Cornu <philippe.cornu@st.com> Link: https://patchwork.freedesktop.org/patch/msgid/1506936755-23625-2-git-send-email-benjamin.gaignard@linaro.org
-rw-r--r--drivers/gpu/drm/bridge/panel.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/gpu/drm/bridge/panel.c b/drivers/gpu/drm/bridge/panel.c
index e0cca19b4044..6d99d4a3beb3 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);

Privacy Policy