From patchwork Mon Mar 6 10:07:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 64547 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1755964wrd; Mon, 6 Mar 2023 02:11:35 -0800 (PST) X-Google-Smtp-Source: AK7set8lyt/xUPidM2uYEXwwpYqkjN9CGMDtMoN037YcdLd+0EyJyQuJR3coQ1GABKIt2Z9/Y2WF X-Received: by 2002:a17:907:3f90:b0:878:711d:9310 with SMTP id hr16-20020a1709073f9000b00878711d9310mr11065569ejc.1.1678097495057; Mon, 06 Mar 2023 02:11:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678097495; cv=none; d=google.com; s=arc-20160816; b=awsCysuK2oAMjKeV0OkYjYXwlnDGNZmHSpL1udgCD8v4F67JAVQzu1gBnE24FSz7wP VhbLvcQQA43J/BMy5yqRwOIJDz3cyNZ5/zjJ7C0yiPhSzjsXpXwyjf6+yXiTQ9y9KOEz j3Woi6KRRv1rpkjiMX8eMyq/xPB9pis89veW9CQ3wZhUVc/PP5JpHbDIKxXgXbtLWepR 8G90Cqe2KV7uFp8J9a10Ikw8d6DdZuyJ6fBJHkKOeInc4YKFGBGYHe6gdd4L8ay8WN4/ RMjYEXQsrrrRGIt9docqPkQE7b1+SPFcddNPjAQl1A6XYY7bU+/PkmgcsA5PmY+/J6dS lBbw== 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=yhbt6VWpcmtdxyeFtZhgfSZmeIuag+HxkBf6eGEi88s=; b=U/KUWNNyDLFlLjrH1rF9kGhwi89oUZ33HX5/gLYUnTclzoqbRgoio+1W/IIrGiyReR tS6k+PISwxDP1s3LK2CguPo7BUMBEocm/dvmN/gv/L7AMuqUq+ASYJ/5B/rnHI3Vv5IF 1NVgaYhytDZx/0OYheFJIe2sfa+3i6WKH6mg7FF1lfKX9JEJoA/N6NdZyVIUtNvLjg4x JdA+zbpcxmFUvS74x33dv1/q7ChEWGC+RcMmYwYGOe7cjJ6sHHfMw+UoKxL8TkG/fY3z xkcBWIC8TE9X7z1s1czvdE25cqHCjL2qLuPjpAOipBZB2vzHvSUB/DBbOfhx4D0k8Qhe wK2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="D4K/DO2K"; 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 rs17-20020a170907037100b008dcebb5a109si6907415ejb.563.2023.03.06.02.10.56; Mon, 06 Mar 2023 02:11:35 -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="D4K/DO2K"; 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 S230490AbjCFKJy (ORCPT + 99 others); Mon, 6 Mar 2023 05:09:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230244AbjCFKJX (ORCPT ); Mon, 6 Mar 2023 05:09:23 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FD98222E3; 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 E7A52B80D75; Mon, 6 Mar 2023 10:09:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83D85C4339B; 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=1678097358; bh=bGa3LGEVgDSMBMrHbY9SDca40Ab9EZJo6raY1+G6bnw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D4K/DO2KNmrupnIfHYchxc2UfYBt+ntb9XeIKxWGY2NvBnr/6pLEOGvemrg5fN2Ng TDJDSWJnlYK7NM2bkxFtMOJxLHJVlFpUbr+FiIG8IN3B9mOORHSv7o87F3gv4Tijg/ suIUfLnherbiHKtKgP5iAsBoXOd+Ao9o2eDq0fT4jqNGh7Q104rOdU5WZRNsMCVY3I ZDtHhN4TUeQ68TtJsBTlDoo/iKSMV6YsFHhwOMLvgtPAs8cWXHV7K0ixfLS8piv/F4 eCUvpOujgpTkX4c0tW1ZCXJxxoQZmhlCgZxOH0/Oo5hVjzAuypSTNG+gv4yV93FL3j eGlI8UyK2RmoQ== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1pZ7n5-0007Qb-1F; 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 , Jiasheng Jiang Subject: [PATCH 01/10] Revert "drm/msm: Add missing check and destroy for alloc_ordered_workqueue" Date: Mon, 6 Mar 2023 11:07:13 +0100 Message-Id: <20230306100722.28485-2-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?1759612759052557290?= X-GMAIL-MSGID: =?utf-8?q?1759612759052557290?= This reverts commit 643b7d0869cc7f1f7a5ac7ca6bd25d88f54e31d0. A recent patch that tried to fix up the msm_drm_init() paths with respect to the workqueue but only ended up making things worse: First, the newly added calls to msm_drm_uninit() on early errors would trigger NULL-pointer dereferences, for example, as the kms pointer would not have been initialised. (Note that these paths were also modified by a second broken error handling patch which in effect cancelled out this part when merged.) Second, the newly added allocation sanity check would still leak the previously allocated drm device. Instead of trying to salvage what was badly broken (and clearly not tested), let's revert the bad commit so that clean and backportable fixes can be added in its place. Fixes: 643b7d0869cc ("drm/msm: Add missing check and destroy for alloc_ordered_workqueue") Cc: Jiasheng Jiang Signed-off-by: Johan Hovold Reviewed-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/msm_drv.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index aca48c868c14..b7f5a78eadd4 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -420,8 +420,6 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv) priv->dev = ddev; priv->wq = alloc_ordered_workqueue("msm", 0); - if (!priv->wq) - return -ENOMEM; INIT_LIST_HEAD(&priv->objects); mutex_init(&priv->obj_lock); From patchwork Mon Mar 6 10:07:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 64556 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1759750wrd; Mon, 6 Mar 2023 02:22:35 -0800 (PST) X-Google-Smtp-Source: AK7set9JiCURd7+c3HPRpjg9/vdiorIRH6/XkH6dLHKjSXVhZBb34cO/cG5ABmp7z19WOnAbRwJe X-Received: by 2002:a17:906:d9c2:b0:8b1:7b22:90b6 with SMTP id qk2-20020a170906d9c200b008b17b2290b6mr9337290ejb.37.1678098155019; Mon, 06 Mar 2023 02:22:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678098155; cv=none; d=google.com; s=arc-20160816; b=F5YY9IEKV89/kDToFWs+DdyxNdeW66FCJQg18aCPyL7p1DJtdJg3zhFeuYM3SgB2jW F9/uVOnAN+XA1wgEuLJPHaI12XSZAKVv5eKxlURHn8NhXGnldNykwq7c789MCJWxV/w/ K5mPRehV68CNj9798YD7gRTXYvl7XhIvdPGovJIH3Iv2QWyDIimd0hYq6RDD2CpQUE12 8SBXymbwxrMwevyDSQf8uqOJKxF2eWN0DtLqOEuu2tP9yIokjryMQewYBCkfV/9FvrRB 2a7Yx8yv5uxYAmnc8ulS5jms9ySiZts9DG0DSPI+I8Z+GYtN42ONXW1tACLOdgPjn+P/ UtUQ== 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=DjoEi1SlzrLtrLNrhJZyWFhsKzbH+ZH3p7lnur5URSA=; b=W5zm11EH3PFSaM9/30G++8ECIOvpS/hoe3h+VTn7M962lhmqRJ8QLiSHUWO2jrEQkE uOq/fGjMhHgAAdUmujC716I8xXm1w+1hwBVv3uPpqCqvkOqIqVIyv8U+8KJvcfYEDsfI +/XOFc1y0eOBTnWJTVYpQKRN9bNx+LfvxgF4S4UYU2e9Tj1Shrk5mzUxYrKckQuJ5Zwf 1d6I9PihfinKsu+jMOBMvqhpgEQJYVnssUtDyHGNzreJZFJK+dyJMcW/kvdMWOxpgjWS zUV2S1P32UD3dM3ba1x4Iec3sfqFYGjenBKkSv+qu6lzMky/Fk7p0EPikwX3fx9eoc1x /3pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qpjXXYZI; 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 r16-20020aa7d150000000b004af51dcb01esi6985983edo.449.2023.03.06.02.22.11; Mon, 06 Mar 2023 02:22:34 -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=qpjXXYZI; 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 S230195AbjCFKKB (ORCPT + 99 others); Mon, 6 Mar 2023 05:10:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230292AbjCFKJX (ORCPT ); Mon, 6 Mar 2023 05:09:23 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4EC42222E2; 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 BECA0B80D34; Mon, 6 Mar 2023 10:09:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7AA50C433D2; 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=1678097358; bh=O0hTTeG0QACttF+fPXxT6uAirlSnSJBFPVa+P9Yvy/E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qpjXXYZIym9UdjFV6O62sj5OjqtochKZULP2b69pLqWSCTZNQTzEejftf/Z7xMj0K qfsZ4PZpmX+tYN3oYGAB2oDZuHylS83gOPYBaUoyh5HF7MgG9uT3qsSugcjOfe+vy4 VswTjv9xErBdJ8T3bzmaBp5lmGsn4cZRspEuUdIbnT8+1bjgMHrFuSxSPWO6J4wUhv NE+MnaJlKa4TFAoTOwRp7xETj1Mr/hyYDrqIZ/Tvwzv3citvV+MgJO2Y5xKyMN/L4F WHqUgVUdAR55D3A7M7Ppo+yJA15ZEmQqmwnWQDnaaB0nWraF0ECtvVM58FV5A90vBN n7dfvW3Y41CJQ== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1pZ7n5-0007Qd-4T; 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 , Akhil P Oommen Subject: [PATCH 02/10] Revert "drm/msm: Fix failure paths in msm_drm_init()" Date: Mon, 6 Mar 2023 11:07:14 +0100 Message-Id: <20230306100722.28485-3-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?1759613450757797782?= X-GMAIL-MSGID: =?utf-8?q?1759613450757797782?= This reverts commit 8636500300a01740d92b345c680b036b94555b1b. A recent commit tried to address a drm device leak in the early msm_drm_uninit() error paths but ended up making things worse. Specifically, it moved the drm device reference put in msm_drm_uninit() to msm_drm_init() which means that the drm would now be leaked on normal unbind. For reasons that were never spelled out, it also added kms NULL pointer checks to a couple of helper functions that had nothing to do with the paths modified by the patch. Instead of trying to salvage this incrementally, let's revert the bad commit so that clean and backportable fixes can be added in its place. Fixes: 8636500300a0 ("drm/msm: Fix failure paths in msm_drm_init()") Cc: Akhil P Oommen Signed-off-by: Johan Hovold Reviewed-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/msm_disp_snapshot.c | 3 --- drivers/gpu/drm/msm/msm_drv.c | 11 ++++------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/msm_disp_snapshot.c b/drivers/gpu/drm/msm/disp/msm_disp_snapshot.c index b73031cd48e4..e75b97127c0d 100644 --- a/drivers/gpu/drm/msm/disp/msm_disp_snapshot.c +++ b/drivers/gpu/drm/msm/disp/msm_disp_snapshot.c @@ -129,9 +129,6 @@ void msm_disp_snapshot_destroy(struct drm_device *drm_dev) } priv = drm_dev->dev_private; - if (!priv->kms) - return; - kms = priv->kms; if (kms->dump_worker) diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index b7f5a78eadd4..9ded384acba4 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -150,9 +150,6 @@ static void msm_irq_uninstall(struct drm_device *dev) struct msm_drm_private *priv = dev->dev_private; struct msm_kms *kms = priv->kms; - if (!priv->kms) - return; - kms->funcs->irq_uninstall(kms); if (kms->irq_requested) free_irq(kms->irq, dev); @@ -270,6 +267,8 @@ static int msm_drm_uninit(struct device *dev) component_unbind_all(dev, ddev); ddev->dev_private = NULL; + drm_dev_put(ddev); + destroy_workqueue(priv->wq); return 0; @@ -442,12 +441,12 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv) ret = msm_init_vram(ddev); if (ret) - goto err_drm_dev_put; + return ret; /* Bind all our sub-components: */ ret = component_bind_all(dev, ddev); if (ret) - goto err_drm_dev_put; + return ret; dma_set_max_seg_size(dev, UINT_MAX); @@ -542,8 +541,6 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv) err_msm_uninit: msm_drm_uninit(dev); -err_drm_dev_put: - drm_dev_put(ddev); return ret; } From patchwork Mon Mar 6 10:07:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 64581 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1761295wrd; Mon, 6 Mar 2023 02:27:13 -0800 (PST) X-Google-Smtp-Source: AK7set+cgeyBMmqAGw7mY60dTWg5C65xpo6vMUiud67FOYpi+sXgXV4/IVAqOQYvbex5pP+wUnOQ X-Received: by 2002:a17:907:8a06:b0:889:ed81:dff7 with SMTP id sc6-20020a1709078a0600b00889ed81dff7mr12960164ejc.9.1678098433550; Mon, 06 Mar 2023 02:27:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678098433; cv=none; d=google.com; s=arc-20160816; b=z0Aw2qJApnkeEX4BTO8S6/QauspxXTFbxs5aXlmXKrvmjgnyt10p4HGTYnOon+kCsz D3XkJxu/XyW72Jbc5dEl3Nd8ymno3f5lL3Brx87tyxi513P6qBm98+KoxNMW8LMns9UG dNi/EFs5jl+8ji5uGgxqANP3qHwW86n6gSCYjiawXYK2sgP8yjQiH7hlttZCfaCXfpr+ MeEuxDg5DXRDTRJG+zvdLZVSoPP6cFk5vO87dugHkx83CyEBP7s7V2XewS/mbqDTJDwk zTld8Mv93FzQxXtEsSWDGevDKbD/TCVUT5Q+8XZuzeyTdEBcPBauGybeJaWaxIbAVTe2 FlYA== 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=TkegV801ASP6OIM88f/HPamDvWOBYYOHqU4SJglDDJw=; b=u4WmrIA+mBVMgSLy5R8vV/vrIXksMj963sQFCt/PvE6DdMT1hTudmWJqtdnDTEDWwN s0u0jpC6OV3MEnVCbouTKlYsa8NEci8ZtXH9MKBEbZfKmShA0CQHGiRFCjbfevWhWIiZ J/JSDIGnuapdW1yCVP1BJ+iPWDGhT8+3JDIoxZiqXnxXlQzxVZ+MPMhkGo96G9OgzlZD O0B/iKHGyFfdMUERgFWs/Q5gtUF5yt3PBue8xAC7pQTHwBmEKDbMo9QvWCYUIa36RZ32 amkv4e0h2u4MmGOdo8F8Lp2FtU6HKCNp7nOR+MrbcRMG0riKWo4P4fYXWvvboiBo+TfG lCsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FWY4vLrW; 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 n19-20020aa7c453000000b004bfe6a447f9si9865064edr.186.2023.03.06.02.26.49; Mon, 06 Mar 2023 02:27:13 -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=FWY4vLrW; 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 S230310AbjCFKJ1 (ORCPT + 99 others); Mon, 6 Mar 2023 05:09:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230272AbjCFKJU (ORCPT ); Mon, 6 Mar 2023 05:09:20 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A41CB22001; Mon, 6 Mar 2023 02:09:19 -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 42D0E60DC1; Mon, 6 Mar 2023 10:09:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 98A49C433A1; 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=1678097358; bh=oHtOiiLls+D/brpZp/GfYW0LOJJAvdIWo6VBajIFJFk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FWY4vLrWgV44TRuLq2J4Mfxnhm4vWWeRrePKjiND/BjJ8pjdbtFYWkdbOY6u28fXF 5xSUDav0bMngErNyVJQ+EUR/6z0MUMlsJza97tywfH2jjIl4DMMQo/kKC0COBlsvzr n48eO7snFlpxYT9QcvifF2L3xPa2krIgZfprVnQSVoKfU2YRz8L4BVCR/SEy8YN/iq MCi98skpVAP2AJR4oj1k9b4zqai4ho+ID6Q2Ph0+411m7N2u2ESgJFKoMKkCO52Gcp wHJb6uzimOIeRgVzRn/ZJEt/p/e7CzZtjzu0i4QHtw++GBWcPYCWnb+XPp+Oj6z1gI LYvQOqHte8c6A== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1pZ7n5-0007Qf-71; 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 03/10] drm/msm: fix NULL-deref on snapshot tear down Date: Mon, 6 Mar 2023 11:07:15 +0100 Message-Id: <20230306100722.28485-4-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?1759613743230338386?= X-GMAIL-MSGID: =?utf-8?q?1759613743230338386?= In case of early initialisation errors and on platforms that do not use the DPU controller, the deinitilisation code can be called with the kms pointer set to NULL. Fixes: 98659487b845 ("drm/msm: add support to take dpu snapshot") Cc: stable@vger.kernel.org # 5.14 Cc: Abhinav Kumar Signed-off-by: Johan Hovold Reviewed-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/msm_drv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 9ded384acba4..17a59d73fe01 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -242,7 +242,8 @@ static int msm_drm_uninit(struct device *dev) msm_fbdev_free(ddev); #endif - msm_disp_snapshot_destroy(ddev); + if (kms) + msm_disp_snapshot_destroy(ddev); drm_mode_config_cleanup(ddev); From patchwork Mon Mar 6 10:07:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 64565 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1760665wrd; Mon, 6 Mar 2023 02:25:28 -0800 (PST) X-Google-Smtp-Source: AK7set+JFponFpFypcX73BHIOxDndoiEQjTbkgZv5QzcscZnLQ8riamXEOhxr+oSTGIkzUGDpsXu X-Received: by 2002:a17:906:10d8:b0:8aa:c2e1:6a64 with SMTP id v24-20020a17090610d800b008aac2e16a64mr11525527ejv.61.1678098328024; Mon, 06 Mar 2023 02:25:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678098328; cv=none; d=google.com; s=arc-20160816; b=W62Pqbmnip76VBV2TKv8ctoaKj5noAIjS8Z3D3u0tMkWAij2q+BeWcjj9vC55ZEWxO d+IyWLDwpj9uPX5Ss/RutEqHaOR91foo8Aa6enfsEpF2gpBiYgaGUga6IoTllLsDKUM2 xAMclssVbJ/YWEtP9QGlWMDoBh7flzZ4u/8Um7t+7mZJG4457Vkv8QvsWWu4BE/pW9Px aqH9q93FTNmn56AwKzeRVhwKu9bGT91J7qscY6zhixAlrHxFb5QIW8KwKTXAFHBvYcZ0 TCGP2xm2xM/+IFfiX87UGq/gOM9FjoYvXxQDsWiPgBB6qyQm4W3NiGhBktAWLv2nkGdH DDkw== 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=bGdTcXJvByR+LFOxTZ0by8ESuvFN3qQtnKeXR8A1lPo=; b=ToJ7hh95qOW/uyYXytH2+7bFstitVgriRngx+ShO9e6R/NDV5TE31gmTPtWoksMEMd XsUvnAcCvCBLB8nh82e7lbLpf+N9pxagxqWkXgLf+j7Et3n2o3hhHR4klSe+5bq6Myjs BNj9fTdOaDU5jgVQcOL2EpD5856Ob2cG56Xuh3lP7yAcYeZ7NnoQdKOK/OXwCbFlrY19 8FpihU/XdYUWcHCVuKDsSjBN9Y/OwECJQO68/32VUJ9ZJQEGm4x5XK4fQkX47GYO6uo6 dEbTWV+Ml4E9wyuqaDlcSOrV2o/PGTYX+pMlIrPrCjScrwRQ/9g6p6wQosnnVYV4+nQ2 PQWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JPL2f+tK; 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 oz25-20020a170906cd1900b008d2b0211398si6185678ejb.534.2023.03.06.02.25.02; Mon, 06 Mar 2023 02:25:28 -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=JPL2f+tK; 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 S230411AbjCFKJr (ORCPT + 99 others); Mon, 6 Mar 2023 05:09:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230274AbjCFKJW (ORCPT ); Mon, 6 Mar 2023 05:09:22 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A44ED222CD; Mon, 6 Mar 2023 02:09:19 -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 4164B60C61; Mon, 6 Mar 2023 10:09:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97427C433A0; 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=1678097358; bh=4+aatQXI0SCxRlCzdLvMFS4VkyXlIErsdSaIxooTjLo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JPL2f+tKt/HlM/ila+Orez2fDpuyMV0hIP4O874wDP4+xCQEchxA603rlXWnrkk6c kIEhbFdGw3uBtjiSVawaRUDsNzbaqqs2epRR19PgUyvgIIJSKvHc64VeqzFcc2s70N m+lcsfh5V86J88FjoMXYhgYwnqBf4RjYRYrTpsvy3YcZHelZJeE1MgiAbHVFdbBf07 pIO9ZEEo7VWv7jmcZfrGckJPQXErTytebZr3qfBgChPdP59WuZ9qEe7/Rrr2dbavO5 ZKgOMx1LSAWdzux+8TYBELjRKvLtaTIWj+k6h/te4YBGOz5AzKPvyJZ7n7XFYQ1g9w 20iTjSh2bjAAw== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1pZ7n5-0007Qi-9X; 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, Thomas Zimmermann Subject: [PATCH 04/10] drm/msm: fix NULL-deref on irq uninstall Date: Mon, 6 Mar 2023 11:07:16 +0100 Message-Id: <20230306100722.28485-5-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?1759613632222395763?= X-GMAIL-MSGID: =?utf-8?q?1759613632222395763?= In case of early initialisation errors and on platforms that do not use the DPU controller, the deinitilisation code can be called with the kms pointer set to NULL. Fixes: f026e431cf86 ("drm/msm: Convert to Linux IRQ interfaces") Cc: stable@vger.kernel.org # 5.14 Cc: Thomas Zimmermann Signed-off-by: Johan Hovold Reviewed-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/msm_drv.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 17a59d73fe01..2f2bcdb671d2 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -251,9 +251,11 @@ static int msm_drm_uninit(struct device *dev) drm_bridge_remove(priv->bridges[i]); priv->num_bridges = 0; - pm_runtime_get_sync(dev); - msm_irq_uninstall(ddev); - pm_runtime_put_sync(dev); + if (kms) { + pm_runtime_get_sync(dev); + msm_irq_uninstall(ddev); + pm_runtime_put_sync(dev); + } if (kms && kms->funcs) kms->funcs->destroy(kms); From patchwork Mon Mar 6 10:07:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 64546 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1755840wrd; Mon, 6 Mar 2023 02:11:13 -0800 (PST) X-Google-Smtp-Source: AK7set8HDJDplmxbQ33saYA4/jvbFT8C+pmQ6XYQHFtJUfC4sKE5Ozy2jWdTbgmBu5nIoE/mvc/s X-Received: by 2002:a17:906:d9c8:b0:8e1:cc38:6ab0 with SMTP id qk8-20020a170906d9c800b008e1cc386ab0mr9105304ejb.16.1678097473655; Mon, 06 Mar 2023 02:11:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678097473; cv=none; d=google.com; s=arc-20160816; b=o2ixLa/mM2B97PyZ1jcnOu+XyVrv1xcbe/h6Ff+h2MAFuc3EawAkKtYUh/hUGDYXIA xPiuu2/8zeVhOtXN06pns0kt536+i15FMrduvOYHGAfh/yZQ10c2SgMX1fGhKLnm+T21 1iTUsa2u0A2o2Jd1Rk0xFCbDtBsHa2pnANJTINQXalUmwH2chvjSnatKCGyKMK6zcLT9 7Z6Ur/iPu1S4RwyQ9MgQPaX2jCKyXJH8rO/YGmD31lLlaM/ADSdCpckLYhia/QXZo55H shhDYucrzB6h+rKi9Qeu0jRYhbmKWePbIJhCJvkkMDolkIneCtRSPuo13geu5AMwED2x 5mVg== 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=d1bG9iQrBnEURa54NtoxMejeWDHLeDJA0izjTL7T3IQ=; b=AxzVY6EShlXdPTUuNV8z1hZKm42ncGmR/mfBeZL8JXefytha4T4g3PZ3BIRJ2hA18y NdKTEOF8LOihkLuqgZyWsHDWV3q+N0h8Z+7N99OX0V0MN7rTN8wG4qcAiHv3d4/Y839R FYGbaAqTIjQieI5RK5WGlO83jT6hcwefxkQ/RQ3h2elhtVMpEfaq+WWTov12yvGztrCb kPUdXVM1jVTDMAPYv8jyS0i9DdKdw+WrxwmpCQYpn2+ynvPgL0ZpULWp/eaSEAgtKuG5 J5tkV3AfOw+6E+krjU+ZVjiyuKZQEn3sH4NbmCVObyq/ZAqlUG6rmKp27MZPZdNV2xvI cB4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=c8BncGvg; 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 kd2-20020a17090798c200b008e5082870a9si9438571ejc.574.2023.03.06.02.10.49; Mon, 06 Mar 2023 02:11:13 -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=c8BncGvg; 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 S230461AbjCFKJv (ORCPT + 99 others); Mon, 6 Mar 2023 05:09:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230280AbjCFKJX (ORCPT ); Mon, 6 Mar 2023 05:09:23 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45ED9222E1; Mon, 6 Mar 2023 02:09:20 -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 D1A9160DCA; Mon, 6 Mar 2023 10:09:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9DF96C4339C; 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=1678097358; bh=X7Gj43NEKH3ef23xjVhwnnWwIQxNkYo2UW1bxn+SqkE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c8BncGvgcE6nNUvBtSWfH1uDOZUB3o+kJy7hCuVAqZmnT56FGYwjCf+7FiOFC2lf5 rw8XNSPhLLKA1WlR4/GeruxoZUVT8EZFoiuzpVum5aeg25OF6aLjs00WtOq4aJ5cdh VXVZJo5WogxLOQw6b4Qhcx0MiTP5CtTSQVeS6r13+aXF09RYyyYX27ziBAWBLHZ2Us zIsp6CXnP5hhory3bwWCJLp8pdifROWqwystI2L7qrosrcoviLDutr8oCB3ngtU0nd aTfllirJ+xDBWxgfvFhN6Ng+D7MMDeSm0WLbQ6LV/SPfmzdSiWYDZujFaIlLORnUKY Q0vjuwbcmS8xg== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1pZ7n5-0007Ql-C4; 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 05/10] drm/msm: fix drm device leak on bind errors Date: Mon, 6 Mar 2023 11:07:17 +0100 Message-Id: <20230306100722.28485-6-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?1759612736691203049?= X-GMAIL-MSGID: =?utf-8?q?1759612736691203049?= Make sure to free the DRM device also in case of early errors during bind(). Fixes: 2027e5b3413d ("drm/msm: Initialize MDSS irq domain at probe time") Cc: stable@vger.kernel.org # 5.17 Cc: Dmitry Baryshkov Signed-off-by: Johan Hovold Reviewed-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/msm_drv.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 2f2bcdb671d2..89634159ad75 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -444,12 +444,12 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv) ret = msm_init_vram(ddev); if (ret) - return ret; + goto err_put_dev; /* Bind all our sub-components: */ ret = component_bind_all(dev, ddev); if (ret) - return ret; + goto err_put_dev; dma_set_max_seg_size(dev, UINT_MAX); @@ -544,6 +544,12 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv) err_msm_uninit: msm_drm_uninit(dev); + + return ret; + +err_put_dev: + drm_dev_put(ddev); + return ret; } From patchwork Mon Mar 6 10:07:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 64567 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1760857wrd; Mon, 6 Mar 2023 02:25:58 -0800 (PST) X-Google-Smtp-Source: AK7set+5wEIXj58jv1BRlafEiHzE09QsT1equ/FSACWeaY4BrTFXLV5pKm8wBx0GB6aAvC8+EJpf X-Received: by 2002:a17:907:9702:b0:82e:a57b:cc9b with SMTP id jg2-20020a170907970200b0082ea57bcc9bmr10657327ejc.24.1678098358709; Mon, 06 Mar 2023 02:25:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678098358; cv=none; d=google.com; s=arc-20160816; b=gf7KzDWKe3060Xb6fIloK7X4QD4iu5caBmeDnDcZ4Iq4JWRt+sMZufhZZsCWAoDxRo af+P3k7ekENlvovdbd3FY8FO4n9ncz8nVzvBnjd+qep4RqC6TatH8VTi26H9jJ5IUwaB jBAR14XsIRzMrcGVVNZa1IYctb14MFCPACKhHHTy/nWGtKSIc59ThgLquqzvmLEivFsc OSfkesOUQU/qF8fv3oF6NQsmMdagdeAY3WU+QEw25k0XPbCpuL4WTOeHGDcJgkct854a Yw44KZri7YSj8nldtBNhCf1D+6RMTaOVnC6d2fYLVKXiAxBT5lnotChGgyykxDjtFGLj KshA== 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=rUzi9VtIfxO5fFJyCiI4CE8G7paqLjzdWeXiiZIIcWI=; b=elxV5zvcI/qMRd6F8aMgWKEFkrqsakY2/kL4n4rr0tXNBFbeSD4+ylnP3HNiXE5cb3 6fPSR56lEKTGBNDkk/H9kwDkiP9pSa+Ul7pK88a1apCpO2pBVmb/nduLvV/rmHZ12fcy C3wsx0uS81SDq1gYIm6YtTGwfmz/RRCdOIw+aVLGejwE46cxuGGBtn50II6oSbMRolRd cCL1yRalU2BVPeMrHru8Qbw1Zm4aCU9e17DpNqAhe+8/lPimo+yKNJrMHVFT4bDLQIim 61r/vXx2L//5v9QQmiFI9aqA1jzCFNylPTb5AUQ/iYCX78DyO6O8r9Dpy/ylVsiMBfPj JYKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=kgo+sXz7; 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 x15-20020a170906134f00b00909ec650e04si8956495ejb.487.2023.03.06.02.25.19; Mon, 06 Mar 2023 02:25:58 -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=kgo+sXz7; 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 S230244AbjCFKKG (ORCPT + 99 others); Mon, 6 Mar 2023 05:10:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230295AbjCFKJY (ORCPT ); Mon, 6 Mar 2023 05:09:24 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC72DBDD4; 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 9866AB80D7E; Mon, 6 Mar 2023 10:09:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C1747C433B0; 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=1678097358; bh=uqvw+1pPZqa3n7JUisPLnCC2+5ng04ROJJhyzn6R2aQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kgo+sXz7XTVxNF0eFyruT96oYiVmmTPThA28T0KckXZ4WWNJYYNzEQv2504qqdPfw dRIQJk/iNj7y5NxqWiKSljgClNgwB82YP2hgSzxfVqxL2Bu3v8PIKOD46X3rVYXUPL g+vZAt63IRSksCsoRyOd7I5QWyqF4AE4vXwZEZMehIZP/dS2OnnhVIWxQitO/LLQzj b3y59NTU3AGxYV02OVFYxQy3ALV8yyxzcdByiuz33ETmPBr+LJViAslA/MFwBUnE5Z ggzRuuTKM910iaTqBtC7NmHLDSxIizP0uxLankzyqGNDKSr/0oLw3JCMnXSkDHSAfa ohmugVe96Nceg== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1pZ7n5-0007Qo-Er; 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, Craig Tatlor Subject: [PATCH 06/10] drm/msm: fix vram leak on bind errors Date: Mon, 6 Mar 2023 11:07:18 +0100 Message-Id: <20230306100722.28485-7-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=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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?1759613664630020464?= X-GMAIL-MSGID: =?utf-8?q?1759613664630020464?= Make sure to release the VRAM buffer also in a case a subcomponent fails to bind. Fixes: d863f0c7b536 ("drm/msm: Call msm_init_vram before binding the gpu") Cc: stable@vger.kernel.org # 5.11 Cc: Craig Tatlor Signed-off-by: Johan Hovold Reviewed-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/msm_drv.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 89634159ad75..41cc6cd690cd 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -51,6 +51,8 @@ #define MSM_VERSION_MINOR 10 #define MSM_VERSION_PATCHLEVEL 0 +static void msm_deinit_vram(struct drm_device *ddev); + static const struct drm_mode_config_funcs mode_config_funcs = { .fb_create = msm_framebuffer_create, .output_poll_changed = drm_fb_helper_output_poll_changed, @@ -260,12 +262,7 @@ static int msm_drm_uninit(struct device *dev) if (kms && kms->funcs) kms->funcs->destroy(kms); - if (priv->vram.paddr) { - unsigned long attrs = DMA_ATTR_NO_KERNEL_MAPPING; - drm_mm_takedown(&priv->vram.mm); - dma_free_attrs(dev, priv->vram.size, NULL, - priv->vram.paddr, attrs); - } + msm_deinit_vram(ddev); component_unbind_all(dev, ddev); @@ -403,6 +400,19 @@ static int msm_init_vram(struct drm_device *dev) return ret; } +static void msm_deinit_vram(struct drm_device *ddev) +{ + struct msm_drm_private *priv = ddev->dev_private; + unsigned long attrs = DMA_ATTR_NO_KERNEL_MAPPING; + + if (!priv->vram.paddr) + return; + + drm_mm_takedown(&priv->vram.mm); + dma_free_attrs(ddev->dev, priv->vram.size, NULL, priv->vram.paddr, + attrs); +} + static int msm_drm_init(struct device *dev, const struct drm_driver *drv) { struct msm_drm_private *priv = dev_get_drvdata(dev); @@ -449,7 +459,7 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv) /* Bind all our sub-components: */ ret = component_bind_all(dev, ddev); if (ret) - goto err_put_dev; + goto err_deinit_vram; dma_set_max_seg_size(dev, UINT_MAX); @@ -547,6 +557,8 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv) return ret; +err_deinit_vram: + msm_deinit_vram(ddev); err_put_dev: drm_dev_put(ddev); From patchwork Mon Mar 6 10:07:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 64568 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1760860wrd; Mon, 6 Mar 2023 02:25:59 -0800 (PST) X-Google-Smtp-Source: AK7set/vKL92frCgXIVQdektSdmxQspQwi8Dt28FOiASHF4R5n2l766MmWNoYsvMjR20b/sopIw8 X-Received: by 2002:a17:907:5014:b0:88d:ba89:184b with SMTP id fw20-20020a170907501400b0088dba89184bmr10503390ejc.28.1678098358861; Mon, 06 Mar 2023 02:25:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678098358; cv=none; d=google.com; s=arc-20160816; b=N4hGziAD51KL4W3CGO4n16x0jw8ZMYha6/eWu5uNSpSEB/2Uias+AvsDaQYOvVZKBr roQtAyNjWwASB8mY+jAFEyy97kRpHbUFAhrGfPoVpUwxzbEUnTRWZr/1Fd9MR5Bw5iZk I/8xbmLjWco1eCtNxd6OZ1qS65Y3FTdHuMapECz5JCJL3tOAfZR3UK8Xlsxx0GqYBfeO fGLVujbF4x9gFfrEhJWI41Ia4Yok14JdB+jgHoI5+Jh5V7o0pqlLJMUOclrXTenflFln 9rfTDJDMH6RyMZ75sjyGdSYGX0LflJIRkKKFfDntI1uvaaHvfzEItChw6TkWWC0NjAWE bjjQ== 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=ooZEPWexaDwYOGw4H6LyG7aAaeKdV3cp+5VnxIiCJio=; b=H/A/5F0wxZU5pw7GAO07YuCcDWXEuE+lwGfoE3T3wDOzpKeTf221gmOSvsMmfldXWO UO4yku4hqdVcU4x9I2U0jh0JwQIr2LWGFmGsJqpua+dDGhihNPvi1bdcPh3lamFGyz2c ZNfz7uQK6BPrApzIguVsV+1GLB2xqvLqzCQf3WMvL7vzzNjXCmq7+qJi1YtQs3RBuAZo MgS6IYQ2CMepb9oJucM6N6AN7BTinbf140LTKg982ED+ak2IKe1KC0NGaiKLXcPvFbs+ QlBIgVGCIfvZYs6EkwvhnbJyCUGroNAg9QwEc/Mu/UDk9qvX4uS+bSa/hdj58FjOv9o0 7GBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XmLuhUwN; 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 d16-20020a056402079000b004c5248cbebfsi9351294edy.101.2023.03.06.02.25.22; Mon, 06 Mar 2023 02:25:58 -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=XmLuhUwN; 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 S230373AbjCFKJj (ORCPT + 99 others); Mon, 6 Mar 2023 05:09:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230287AbjCFKJX (ORCPT ); Mon, 6 Mar 2023 05:09:23 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43B34222E0; Mon, 6 Mar 2023 02:09:20 -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 CE32460CF7; Mon, 6 Mar 2023 10:09:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C06C2C433A8; 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=1678097358; bh=5WWc/IA6KEuvk5qRgQkziyYcmpqaQV99Q299DA5bkuM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XmLuhUwNoWU4IVC3iCrUwuhv3eh0i+kq4h5bW1w33pSFpe+CwK2HxoWKZsKTByNBf 6yzugc3HGaFj9ddQ/D8SdZPYuyGO/747QGtagRaWE15638eUSXetb085HvdJ0tb0yD k9d59zOGwVE4RqTl7E/wLxO/u8ETt3gibWI5EZEMPxl87z9qhmqYQhRWoA4wc5mfdE Gv+F6VLJAZF1brS+mhjVTpfD0+/8ZFNkL1Wu/rtA6BWzzole3ogicanzUKDc6evCDS uAEGNwIz8xUAj8quEXrn4ZKxOwK7LJnsIiUt9LWN9jh4b+def2ILb+fso6oGj75De0 rxU1+j1HjZ8yQ== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1pZ7n5-0007Qq-HN; 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 07/10] drm/msm: fix missing wq allocation error handling Date: Mon, 6 Mar 2023 11:07:19 +0100 Message-Id: <20230306100722.28485-8-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?1759613664987790007?= X-GMAIL-MSGID: =?utf-8?q?1759613664987790007?= Add the missing sanity check to handle workqueue allocation failures. Fixes: c8afe684c95c ("drm/msm: basic KMS driver for snapdragon") Cc: stable@vger.kernel.org # 3.12 Cc: Rob Clark Signed-off-by: Johan Hovold Reviewed-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/msm_drv.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 41cc6cd690cd..ac3b77dbfacc 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -432,6 +432,10 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv) priv->dev = ddev; priv->wq = alloc_ordered_workqueue("msm", 0); + if (!priv->wq) { + ret = -ENOMEM; + goto err_put_dev; + } INIT_LIST_HEAD(&priv->objects); mutex_init(&priv->obj_lock); 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); From patchwork Mon Mar 6 10:07:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 64544 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1755705wrd; Mon, 6 Mar 2023 02:10:47 -0800 (PST) X-Google-Smtp-Source: AK7set/890c4ID6LjzD5KrsSL5tqU4y3tdfDFeIY8t13L0a2L+7Frc9rS4OlpeiWEnoVQkvkaqkF X-Received: by 2002:a05:6402:383:b0:4ad:1e35:771f with SMTP id o3-20020a056402038300b004ad1e35771fmr8988967edv.35.1678097447069; Mon, 06 Mar 2023 02:10:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678097447; cv=none; d=google.com; s=arc-20160816; b=dYLyunx5aDedipZ1bnefidMnJ+gGUKtFAaFxQBeUcJRH7aClBkp1Sej3i1K9ZdnByr ZyCAmcirV6xYg8znYundMnBs2ye991UzjvRRTmKB6uEggVSzFls/jaO4inguGrPEgLLy JfClkkdeVHO0K4T/V28s12rBeSXRRYRNbm+wnY/ujfhk12j01118N/y9+pinP2zXdHTz 1eDKd25uKMce/toQgeItOqWHYQBVM6CZZSTTbDOoKalKncIqAcer9HKjZBJs6I+SvJOM H+5WVlMtbQhGFPjY6rda/ssTo4CmlZNrp/fd4OTvcxc3OpbtXoPUDkxfADk1wnHEGVvU ePPQ== 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=5Zsu1W/z3JDiobzIQrJRFmRWQh4/4G+n5NfLenBJUu8=; b=hQZcnG6OghsjHElpoN9NtsrEDwflLISXhulGpGZsShEMJxzPB/AM6oySeypFe6ibMe dnyS5GB3JBH4d1zIe0Xn0fy/t+V13Epyct1cQHHwTWTrRFjRss4ljV32SgVq046LDPPY GigTFohTNt9SNv5E//WRP3A3lFMnpSIuSgzTdYdr7cf1CMDCbFcc/AqOkLRCAiDX01z1 1ffyI/LADJfX/LhcD+zpdlBNJv87MV5iPqFyJaiZBhQ8TQ43dsYbpSq+BPL4PrkIf9n1 aZg/6V52BaILYOTr3XrhrwlEoFeH4o1aPKCjDesGYIrSHknTDz0G3ylXmz6h//69rLiJ cOvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IOQ1dpwg; 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 b4-20020aa7d484000000b004acc575090fsi9845940edr.36.2023.03.06.02.10.22; Mon, 06 Mar 2023 02:10:47 -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=IOQ1dpwg; 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 S230325AbjCFKJb (ORCPT + 99 others); Mon, 6 Mar 2023 05:09:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230281AbjCFKJW (ORCPT ); Mon, 6 Mar 2023 05:09:22 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A84E12851; Mon, 6 Mar 2023 02:09:20 -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 0937260DCF; Mon, 6 Mar 2023 10:09:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0204BC43443; Mon, 6 Mar 2023 10:09:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678097359; bh=3O2+vKPnLHdh79mUXLHW8Z5Q6SqDEjWRNnKKiIQoTyo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IOQ1dpwgPoDXO4aiBJSjYqIBjjTrJvx4ZM6BOucb21+jO367iDOtXc9uMsB2xp22s 4hx3KBEAws9s2wc9vNLId50VtSst4NzGH9V7rJvoFS/A11MUBW02HA+0jHS3yCsr8F x8Y/aK2QG7EHznQ7PU5t4uq4USyZh2NMntJ5LgVYZsEDIuyDW2VQ2sL29UXYFQ/0rl zV0hOYaV8DkkUePYi0FA1WuOr3B40kaUOBF4TREIf44sN1/mBHKdUAmbiO7z1rcTpv XhMP/mfQ5RzYfMB5YoMdxx3xgvawGJmdcqDNPZP6M1+SgwsTs8rBSa9tc5pIioox8j 7eXa/DguDGy/w== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1pZ7n5-0007Qx-NB; 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 Subject: [PATCH 09/10] drm/msm: use drmm_mode_config_init() Date: Mon, 6 Mar 2023 11:07:21 +0100 Message-Id: <20230306100722.28485-10-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=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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?1759612708722117534?= X-GMAIL-MSGID: =?utf-8?q?1759612708722117534?= Switch to using drmm_mode_config_init() so that the mode config is released when the last reference to the DRM device is dropped rather than unconditionally at unbind() (which may be too soon). Signed-off-by: Johan Hovold --- drivers/gpu/drm/msm/msm_drv.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 73c597565f99..ade17947d1e5 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -247,8 +247,6 @@ static int msm_drm_uninit(struct device *dev) if (kms) msm_disp_snapshot_destroy(ddev); - drm_mode_config_cleanup(ddev); - for (i = 0; i < priv->num_bridges; i++) drm_bridge_remove(priv->bridges[i]); priv->num_bridges = 0; @@ -454,11 +452,13 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv) might_lock(&priv->lru.lock); fs_reclaim_release(GFP_KERNEL); - drm_mode_config_init(ddev); + ret = drmm_mode_config_init(ddev); + if (ret) + goto err_destroy_wq; ret = msm_init_vram(ddev); if (ret) - goto err_cleanup_mode_config; + goto err_destroy_wq; /* Bind all our sub-components: */ ret = component_bind_all(dev, ddev); @@ -563,8 +563,7 @@ 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); +err_destroy_wq: destroy_workqueue(priv->wq); err_put_dev: drm_dev_put(ddev); From patchwork Mon Mar 6 10:07:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 64545 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1755715wrd; Mon, 6 Mar 2023 02:10:47 -0800 (PST) X-Google-Smtp-Source: AK7set9GAOkZAoa7KnP5SfWqx451Xj3ZEhZaicXAdEU1lg36oZVLXXQZtQBMOLwB97N7KkN5vV1r X-Received: by 2002:aa7:d390:0:b0:4ac:bdeb:6dce with SMTP id x16-20020aa7d390000000b004acbdeb6dcemr9126311edq.39.1678097447807; Mon, 06 Mar 2023 02:10:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678097447; cv=none; d=google.com; s=arc-20160816; b=ypBGpJnxzIHOAhmIwr493fLcGUHjfyiS5C4hITjFZwjpzGmyGbtY8tHDcgnmvUeuzD pGnAcHxrz0gdffs4Tc6pwXDQLkoV98cJbpjLqUf6F1RFHVBYmuOr42yWNyx7R56/F/s5 jTYaFp1yhzSaKfV5afnNydD/vjW/QNOS65Bcy68QXU7VaMYVCuPRvgKve8iBVtsdQGoE d0filkfyhyoHEBi9Hk68ZuFoGEZElhHzmoF8EEy8mu7SzA6KeMxCT0aGksI+GW6pb3vq 4rZndYQaBSehKvp9kQlGuf5huSlLSeZQowEX0Msh5mh1e7Hva4UJFVPjJhe8WQ3IM5vT oyFg== 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=Y0lBtXnfrihkpC4XDcuRlvcb0sgP8slO6q8XPcz2Xhw=; b=rDsHWcNuHY6mnoagnmKeybK1NoeqAamm+J8mqxoTYFva74mvu+0uGyYNx5rug85qw5 6Yn3wRqQ45+ruXO1TOrL+VSWjrI902hqxNHMIra/8siIrr880Tj+YHATXli1vxhgUqu5 4pFJq98UIYOgRRcNQpHDxEM1+lF8iX4npbRNJehyZm0UiQJGSMTMo9I3+HW6RBkma1s6 /dXhzhPejvpKmodAZ0+Qt1ZStBeHWXV/ZlfbZgh3KW0OC7XphssIcjoTnkToMcu9K+vO HIEcMtl0yRmQgL/2MweDJPZS5c3RcKfS+OFXz7ehrCazc47FtoHFp8jVPU9DlWFdfIfB FH6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CkpNJJst; 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 k19-20020a1709065fd300b008b17e88ee87si9080303ejv.537.2023.03.06.02.10.24; Mon, 06 Mar 2023 02:10:47 -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=CkpNJJst; 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 S230346AbjCFKJd (ORCPT + 99 others); Mon, 6 Mar 2023 05:09:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230286AbjCFKJW (ORCPT ); Mon, 6 Mar 2023 05:09:22 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FFC7222F1; 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 dfw.source.kernel.org (Postfix) with ESMTPS id 0B85C60DCB; Mon, 6 Mar 2023 10:09:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14371C43445; Mon, 6 Mar 2023 10:09:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678097359; bh=b151yW+qXdaWwZr+uJKZCMaPRLko8VNYQPQR6bpEA/Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CkpNJJsthW0e/lsNOja6kI178cQAVWSxRPwJbe7ITZtDKyFNkVC0OwHWMoVq1Wi0/ 6BhvtipTNV0HHiROwWY7E6EaLKiedZoxV5zlzzNs+mTHAFkuVN893iP1O1K3GJyQi3 VlDEVI45ff/2yTwyIrpuD1Tfri98WoFyyXeAOX3BuAIEnjdNndeb3RomSmR4iN+H0h DZqR399MX86QV7gYtONI5PdqJPsG/oNlxMkNCPfW/rjAy8xuXXsjhptPYN9LBxpLwj 8U8gU8Q3afvyLi+8J8FOETfZGBBNWhLBbdqD43+0DIIfW9sexuM+hjmIafGEedRj7D n9PhgmHrzhLIg== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1pZ7n5-0007R0-Q4; 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 Subject: [PATCH 10/10] drm/msm: move include directive Date: Mon, 6 Mar 2023 11:07:22 +0100 Message-Id: <20230306100722.28485-11-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=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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?1759612709064963611?= X-GMAIL-MSGID: =?utf-8?q?1759612709064963611?= Move the include of of_address.h to the top of the file where it belongs. Signed-off-by: Johan Hovold Reviewed-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/msm_drv.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index ade17947d1e5..42ae7575622b 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -272,8 +273,6 @@ static int msm_drm_uninit(struct device *dev) return 0; } -#include - struct msm_gem_address_space *msm_kms_init_aspace(struct drm_device *dev) { struct msm_gem_address_space *aspace;