From patchwork Mon Mar 6 10:32:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 64591 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1768364wrd; Mon, 6 Mar 2023 02:50:19 -0800 (PST) X-Google-Smtp-Source: AK7set/jZPEVbaiZxAfuaHKyHexgMWGuWIF1shR5fkcT1kcYw/v2wWGiQpwRig/yhD9c6+lHDHUF X-Received: by 2002:a17:906:33d1:b0:8b1:7ae8:ba79 with SMTP id w17-20020a17090633d100b008b17ae8ba79mr10145191eja.30.1678099819049; Mon, 06 Mar 2023 02:50:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678099819; cv=none; d=google.com; s=arc-20160816; b=TejTLM/jJ6OGBeadnEIv3pY8+SjY083oONmUBiVomofttGZAtiSY/uP5jBerv/RzPW x5Q1WeIxpfSPPyL/nTuH0n8xHFal0xXK5Oad/5BCoYOZzT6YpwRgv8mwpxb8Ju2zdyv6 nCK5E75xW3+J2ZxcWGkPhtTqDN6DPNLDQ0HCEj3UebMGPAZDGkV4Xu61nsNfpik4ScJq XuNRZp/p9/LaLUP2duo/+TtaqH+nnueSfYqQzJnuL0xcq7u8BWA5lLMxYXgXlXRggT0t AWZ8sfmEPxpWAUcWCqTt/PgvQCFvM6+bk6g1E9oFLRf3zZhQLunXWAk5t3r0SeQQZ0YH VdCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=VAZqwOZcw8VDZwLhVU1V6XiumQZ+7w6W08yolUwEFqc=; b=kaUYBHrLByKXE4UJICelrESSHvITPYE+QNLGDMHSFBYUcXwlLhY9uoiRtmc1c+ggM2 1Z2arhsAJz0HGT2Jn0kHEuLc+UVzUvmCIuRyL6HccLaaForTt8pqw3LvDkMMmX0M3QST 3AhBKigqSHtQPhWMcFX5xwGHx/3i22GkYNGloYU/HIUBnB52pgGA3vz6RlfqKBVdzlzl qiCu937zbr9wtv0TfxPiBu3hG5l4R+XVoqnb2Vc8En06BQbIkpt00l/C67HgOJUbodor pYoBYjFOQRAonijNC0zWrw7yXhB4sk24QfHkGl0cJaUR3HUJilus7pVsY9abU5dFeaQs kk/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jiNOsXJj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qw15-20020a1709066a0f00b00914500fec12si239252ejc.648.2023.03.06.02.49.55; Mon, 06 Mar 2023 02:50:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jiNOsXJj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231331AbjCFKd5 (ORCPT + 99 others); Mon, 6 Mar 2023 05:33:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230388AbjCFKdi (ORCPT ); Mon, 6 Mar 2023 05:33:38 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D26993CC; Mon, 6 Mar 2023 02:32:58 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CFF1A60DDD; Mon, 6 Mar 2023 10:32:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 37D54C433D2; Mon, 6 Mar 2023 10:32:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678098777; bh=s2fnw6i03aDUOVRceqTeJE5GhIX+8kNWvjFzOfwDk4s=; h=From:To:Cc:Subject:Date:From; b=jiNOsXJjsaI2JlLF30jApPis06JPgizoX1wFUIyWw21iPDa61V3wQ2GP36JhldSTx bTkJVFUAwDtaJYoUDNbDyW9RoSWiWNmRBRwM5D6Ofb2IHFidkM+dFp0RL4IXwbO5Ad 1PS3FDGXFW/SxYoXnJAA4yCQ4gd3n0N9LZXjCeiauPvrFiHfYDln6E0Xd3g4k9ttuF MGLf8Q2wsHlc8eJHiX31wUAZ5WZkT+0Lev32PJJm+urVpV6F743MqNh2JQzj9ISpm5 s0SSFUDdbBrEIOMxgsF2dLx4MkEjTqp8bpiv9xbNaUL+xSrwIg2ZlwqQE4thA4QByr 8aU+IWpQp7WMA== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1pZ89w-0001Fr-MP; Mon, 06 Mar 2023 11:33:37 +0100 From: Johan Hovold To: Maxime Ripard , Chen-Yu Tsai Cc: David Airlie , Daniel Vetter , Jernej Skrabec , Samuel Holland , Boris Brezillon , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, Johan Hovold , stable@vger.kernel.org Subject: [PATCH] drm/sun4i: fix missing component unbind on bind errors Date: Mon, 6 Mar 2023 11:32:42 +0100 Message-Id: <20230306103242.4775-1-johan+linaro@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759615196092462969?= X-GMAIL-MSGID: =?utf-8?q?1759615196092462969?= Make sure to unbind all subcomponents when binding the aggregate device fails. Fixes: 9026e0d122ac ("drm: Add Allwinner A10 Display Engine support") Cc: stable@vger.kernel.org # 4.7 Cc: Maxime Ripard Signed-off-by: Johan Hovold --- Note that this one has only been compile tested. Johan drivers/gpu/drm/sun4i/sun4i_drv.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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);