summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Miotk <adam.miotk@arm.com>2024-06-10 11:27:39 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-07-05 09:00:24 +0200
commit3e0daaf28639c6fd22e96eb2f8772ad40e922ee7 (patch)
tree98b17875c2d2fe999bbff6aa61b09c72d3286253
parent87d6bdc006f0cbf297a3b2ad6e40ede4c3ee5dc2 (diff)
drm/bridge/panel: Fix runtime warning on panel bridge release
[ Upstream commit ce62600c4dbee8d43b02277669dd91785a9b81d9 ] Device managed panel bridge wrappers are created by calling to drm_panel_bridge_add_typed() and registering a release handler for clean-up when the device gets unbound. Since the memory for this bridge is also managed and linked to the panel device, the release function should not try to free that memory. Moreover, the call to devm_kfree() inside drm_panel_bridge_remove() will fail in this case and emit a warning because the panel bridge resource is no longer on the device resources list (it has been removed from there before the call to release handlers). Fixes: 67022227ffb1 ("drm/bridge: Add a devm_ allocator for panel bridge.") Signed-off-by: Adam Miotk <adam.miotk@arm.com> Signed-off-by: Maxime Ripard <mripard@kernel.org> Link: https://patchwork.freedesktop.org/patch/msgid/20240610102739.139852-1-adam.miotk@arm.com Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/gpu/drm/bridge/panel.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/gpu/drm/bridge/panel.c b/drivers/gpu/drm/bridge/panel.c
index 7cbaba213ef6..2d6f8280fc71 100644
--- a/drivers/gpu/drm/bridge/panel.c
+++ b/drivers/gpu/drm/bridge/panel.c
@@ -205,9 +205,12 @@ EXPORT_SYMBOL(drm_panel_bridge_remove);
static void devm_drm_panel_bridge_release(struct device *dev, void *res)
{
- struct drm_bridge **bridge = res;
+ struct drm_bridge *bridge = *(struct drm_bridge **)res;
- drm_panel_bridge_remove(*bridge);
+ if (!bridge)
+ return;
+
+ drm_bridge_remove(bridge);
}
struct drm_bridge *devm_drm_panel_bridge_add(struct device *dev,