From patchwork Mon Mar 6 10:07:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 64554 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1758609wrd; Mon, 6 Mar 2023 02:19:15 -0800 (PST) X-Google-Smtp-Source: AK7set/1mLHX2jA0rlH1Fwgb9o4yli/2eCubqh0h+deN2dyGNzfUlKkOyplW6TMKWxhtkH9wFcwY X-Received: by 2002:a17:90b:3e8e:b0:233:ee50:d28b with SMTP id rj14-20020a17090b3e8e00b00233ee50d28bmr10581732pjb.16.1678097955657; Mon, 06 Mar 2023 02:19:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678097955; cv=none; d=google.com; s=arc-20160816; b=wEjo8O8rR9YM6A74VT4dL84mSEucsPOCIKmVsBnRDeamvxqb7ciYD8tvj/PvhZ4SIq ZRVoZnHmMmTRi19asBA1LBw/vx42B6L/QyiiwuAb8UD+yudxW9odVCfBj1Lrih9W0CRF /7oKYQoNyIvPqiXQWreKo9ZxM6o0gbFYa9pgh33i5zCY18lpGkXacRZLMahMaCqqYf8N y4wsM6YrZ/5fRJkFQU7XAma7JSP4ZvRJ2FMDN5GyF0BYwmzKfQWgBCwJud5hxoy2TPqL aduFltRWwGlMIjueM1bRcSeKD5kU87jHevX7prSZ4edgEIy7fF79A84HmOO+AmWAAUuI F6mw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=mCzXFBvt57pJVURJFK2BNd4rUl6Ll9/TrA1zfRIr2CU=; b=AFsMz8hIsDb3B4Yj2cqHVkCpmvwoNyrs2jST/Wkdv4WbQpH1IXkLuA8StTESmklx+K /SNlo37RefqHRA3cFekDEgUtRDiXmkCVZDkjRSquK0BYA/iBbPOLX98LwQ/CqACzOx0l YFNUsuhd3G45uSmBdP2XQg+5Gmscn6qXm8TS76tReDkYT67V31Wh/VwoxEw3R+Go2MGf lbad/ZMLZdTq1ql6dmy5yOqUsUSGLY4cvfIJH7ShXGa8K/TrgufDXF9RCnpePBZ0Jy0f mhFUNUzhHpBdIxmr+uVTUUWU1xALSSjySjxgtnVTAroju3qlLNJZxPv7CgPMQpAfXuNb +/TQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XRnzFwJR; 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 k38-20020a63ff26000000b004fb1c44a4d1si8779526pgi.212.2023.03.06.02.19.03; Mon, 06 Mar 2023 02:19:15 -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=XRnzFwJR; 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 S230303AbjCFKKE (ORCPT + 99 others); Mon, 6 Mar 2023 05:10:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230294AbjCFKJY (ORCPT ); Mon, 6 Mar 2023 05:09:24 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3ED1D50E; Mon, 6 Mar 2023 02:09:21 -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 ams.source.kernel.org (Postfix) with ESMTPS id A1C82B80D7F; Mon, 6 Mar 2023 10:09:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E9E1FC433AF; Mon, 6 Mar 2023 10:09:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678097359; bh=rDU5BreCn1IEiZpcHkbtqMClvnHYxm1xtdxFVkqG/ZA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XRnzFwJRsM7C5JKkLY0cAIM6rr+X551YIOBPQwDQ4kz2cds+EO/6tffdt584fcCK5 mXYRABzCvNFHEqCqNa782uGR1cS7+wPf6GY7HpTpBSykWEZuF3p9JpDBeMLD+agAA4 yMmKF4Dbk7CY9qWCH+4RA2p+rA12QtYFxnkhc8RrF4fbzxsFJ+gBva2LUsfWyW9wH9 om/IK7zXzYyEioXi/CWsUixGErL+i0OYoJ9HtNp6yPxavWH4fhNwR0fuudCSi9V9GG Gm57wOshg5aEbyJm7TqxfMVArn6mdreTF56yXAPwv0nIl5VxLfYN8ALBwwmZgFY88z RMc9udy1qWxxw== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1pZ7n5-0007Qt-K0; Mon, 06 Mar 2023 11:09:59 +0100 From: Johan Hovold To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov Cc: Sean Paul , David Airlie , Daniel Vetter , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Johan Hovold , stable@vger.kernel.org Subject: [PATCH 08/10] drm/msm: fix workqueue leak on bind errors Date: Mon, 6 Mar 2023 11:07:20 +0100 Message-Id: <20230306100722.28485-9-johan+linaro@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230306100722.28485-1-johan+linaro@kernel.org> References: <20230306100722.28485-1-johan+linaro@kernel.org> 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?1759613241753152105?= X-GMAIL-MSGID: =?utf-8?q?1759613241753152105?= Make sure to destroy the workqueue also in case of early errors during bind (e.g. a subcomponent failing to bind). Since commit c3b790ea07a1 ("drm: Manage drm_mode_config_init with drmm_") the mode config will be freed when the drm device is released also when using the legacy interface, but add an explicit cleanup for consistency and to facilitate backporting. Fixes: 060530f1ea67 ("drm/msm: use componentised device support") Cc: stable@vger.kernel.org # 3.15 Cc: Rob Clark Signed-off-by: Johan Hovold Reviewed-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/msm_drv.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index ac3b77dbfacc..73c597565f99 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -458,7 +458,7 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv) ret = msm_init_vram(ddev); if (ret) - goto err_put_dev; + goto err_cleanup_mode_config; /* Bind all our sub-components: */ ret = component_bind_all(dev, ddev); @@ -563,6 +563,9 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv) err_deinit_vram: msm_deinit_vram(ddev); +err_cleanup_mode_config: + drm_mode_config_cleanup(ddev); + destroy_workqueue(priv->wq); err_put_dev: drm_dev_put(ddev);