[PATCH] drm/ingenic: Unbind directly when the IPU port is missing

From: Yige Jiang

Date: Wed Dec 02 2026 - 14:16:22 EST


With CONFIG_DRM_INGENIC_IPU enabled but no IPU at port 8,
ingenic_drm_probe() calls ingenic_drm_bind() directly. The remove
callback chooses its cleanup using only the Kconfig symbol and calls
component_master_del(). No aggregate device was registered, so this
does not call ingenic_drm_unbind().

The clock notifier and DRM device remain registered while devres
releases the register mapping, clocks and DRM device reference. The
notifier can subsequently refer to freed driver data.

Tear down any aggregate device first. Its unbind callback clears the
driver data, as do failed bind attempts. If driver data remains after
component_master_del(), this was a successful direct bind and needs
to be unbound explicitly. This also handles an aggregate device whose
components have not bound or have already been removed.

Fixes: 3b5b005ef7d9 ("drm/ingenic: Fix driver not probing when IPU port is missing")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Yige Jiang <yigejiang86@xxxxxxxxx>
---
Based on drm-misc-fixes-2026-11-27.
Compile-tested on next-20261104: arm64, GCC 14.2.0, W=1;
baseline and patched objects built without warnings.
Both CONFIG_DRM_INGENIC_IPU=y and =n were checked.
The code changes are the same as in that build.
No hardware or runtime test was performed.

drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
index 625ec76cf04d8798d1946249bb3d1305817ff29e..cf7b0f914fc37bf7648d4d35c856911ab3c2e30c 100644
--- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
+++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
@@ -1480,10 +1480,12 @@ static void ingenic_drm_remove(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;

- if (!IS_ENABLED(CONFIG_DRM_INGENIC_IPU))
- ingenic_drm_unbind(dev);
- else
+ if (IS_ENABLED(CONFIG_DRM_INGENIC_IPU))
component_master_del(dev, &ingenic_master_ops);
+
+ /* A direct bind is not torn down by the component framework. */
+ if (dev_get_drvdata(dev))
+ ingenic_drm_unbind(dev);
}

static void ingenic_drm_shutdown(struct platform_device *pdev)

base-commit: bf57105b00e32d37b666c029c8c6b8708391da20