The patch below does not apply to the 5.10-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <stable@xxxxxxxxxxxxxxx>. To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y git checkout FETCH_HEAD git cherry-pick -x c22f2ff8724b49dce2ae797e9fbf4bc0fa91112f # <resolve conflicts, build, test, etc.> git commit -s git send-email --to '<stable@xxxxxxxxxxxxxxx>' --in-reply-to '167930742148207@xxxxxxxxx' --subject-prefix 'PATCH 5.10.y' HEAD^.. Possible dependencies: c22f2ff8724b ("drm/sun4i: fix missing component unbind on bind errors") 6848c291a54f ("drm/aperture: Convert drivers to aperture interfaces") dc739820ff90 ("drm/ast: fix memory leak when unload the driver") 31856c8c1ce4 ("drm/vmwgfx: Remove stealth mode") 840462e6872d ("drm/vmwgfx: Remove references to struct drm_device.pdev") 5bbacc2e7ab1 ("drm/virtgpu: Remove references to struct drm_device.pdev") thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From c22f2ff8724b49dce2ae797e9fbf4bc0fa91112f Mon Sep 17 00:00:00 2001 From: Johan Hovold <johan+linaro@xxxxxxxxxx> Date: Mon, 6 Mar 2023 11:32:42 +0100 Subject: [PATCH] drm/sun4i: fix missing component unbind on bind errors Make sure to unbind all subcomponents when binding the aggregate device fails. Fixes: 9026e0d122ac ("drm: Add Allwinner A10 Display Engine support") Cc: stable@xxxxxxxxxxxxxxx # 4.7 Cc: Maxime Ripard <mripard@xxxxxxxxxx> Signed-off-by: Johan Hovold <johan+linaro@xxxxxxxxxx> Signed-off-by: Maxime Ripard <maxime@xxxxxxxxxx> Link: https://patchwork.freedesktop.org/patch/msgid/20230306103242.4775-1-johan+linaro@xxxxxxxxxx diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c index cc94efbbf2d4..d6c741716167 100644 --- a/drivers/gpu/drm/sun4i/sun4i_drv.c +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c @@ -95,12 +95,12 @@ static int sun4i_drv_bind(struct device *dev) /* drm_vblank_init calls kcalloc, which can fail */ ret = drm_vblank_init(drm, drm->mode_config.num_crtc); if (ret) - goto cleanup_mode_config; + goto unbind_all; /* Remove early framebuffers (ie. simplefb) */ ret = drm_aperture_remove_framebuffers(false, &sun4i_drv_driver); if (ret) - goto cleanup_mode_config; + goto unbind_all; sun4i_framebuffer_init(drm); @@ -119,6 +119,8 @@ static int sun4i_drv_bind(struct device *dev) finish_poll: drm_kms_helper_poll_fini(drm); +unbind_all: + component_unbind_all(dev, NULL); cleanup_mode_config: drm_mode_config_cleanup(drm); of_reserved_mem_device_release(dev);