From: Johan Hovold Date: Mon, 6 Mar 2023 10:32:42 +0000 (+0100) Subject: drm/sun4i: fix missing component unbind on bind errors X-Git-Tag: baikal/mips/sdk6.1~47 X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=91a45b7f396bc9c9698527f5e6c7b48f66087e41;p=kernel.git drm/sun4i: fix missing component unbind on bind errors commit 5622a01b987fa52bf7308a379a435f35d4f1df3e upstream. Make sure to unbind all subcomponents when binding the aggregate device fails. Fixes: e656da9b8498 ("drm: Add Allwinner A10 Display Engine support") Cc: stable@vger.kernel.org # 4.7 Cc: Maxime Ripard Signed-off-by: Johan Hovold Signed-off-by: Maxime Ripard Link: https://patchwork.freedesktop.org/patch/msgid/20230306103242.4775-1-johan+linaro@kernel.org Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c index d06ffd99d86e1..7910c5853f0a8 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);