From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C084DC76186 for ; Mon, 29 Jul 2019 19:51:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 94FE1205F4 for ; Mon, 29 Jul 2019 19:51:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564429861; bh=LzfNP2/2fiV3yQotqscSonDsmaMObuAwMCULeBTHQHg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=YfsFII1+6pKDi+Q77ZMBcQjBAIoldHTBDpBtTWDYlVXAolg06xWbQeLuJ1eeweaCc MGjOzSrlJLFzsxs8HRjECwXDGnxoUramue4JKeP1y0JGEbPYD1wXkNliOdVbQ0Buii BzhV3rBEz0b0T+L3fHo1wHuIgszrwqErMM1izBXQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403837AbfG2TvA (ORCPT ); Mon, 29 Jul 2019 15:51:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:42056 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403813AbfG2Tu5 (ORCPT ); Mon, 29 Jul 2019 15:50:57 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 14FE52054F; Mon, 29 Jul 2019 19:50:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564429856; bh=LzfNP2/2fiV3yQotqscSonDsmaMObuAwMCULeBTHQHg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WdReC12PJtSMpZA4axGc8MeRwLa7Y7QM5wMnBggOlMhE0r8pzgmN6hDNWuIxfCjI0 CPc55Lrjp629yUBct3g5SbxzUumhJnUVaQo2BIIJrHkKSmhwlahZFhkN0ji07thWts ssilu8gdXTL8dZgu63iJXiudVsqtjXxX3DCvTWzI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rob Clark , Sean Paul , Sasha Levin Subject: [PATCH 5.2 078/215] drm/msm: Depopulate platform on probe failure Date: Mon, 29 Jul 2019 21:21:14 +0200 Message-Id: <20190729190753.404914906@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190739.971253303@linuxfoundation.org> References: <20190729190739.971253303@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 4368a1539c6b41ac3cddc06f5a5117952998804c ] add_display_components() calls of_platform_populate, and we depopluate on pdev remove, but not when probe fails. So if we get a probe deferral in one of the components, we won't depopulate the platform. This causes the core to keep references to devices which should be destroyed, which causes issues when those same devices try to re-initialize on the next probe attempt. I think this is the reason we had issues with the gmu's device-managed resources on deferral (worked around in commit 94e3a17f33a5). Reviewed-by: Rob Clark Signed-off-by: Sean Paul Link: https://patchwork.freedesktop.org/patch/msgid/20190617201301.133275-3-sean@poorly.run Signed-off-by: Sasha Levin --- drivers/gpu/drm/msm/msm_drv.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index f38d7367bd3b..4a0fe8a25ad7 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -1306,16 +1306,24 @@ static int msm_pdev_probe(struct platform_device *pdev) ret = add_gpu_components(&pdev->dev, &match); if (ret) - return ret; + goto fail; /* on all devices that I am aware of, iommu's which can map * any address the cpu can see are used: */ ret = dma_set_mask_and_coherent(&pdev->dev, ~0); if (ret) - return ret; + goto fail; + + ret = component_master_add_with_match(&pdev->dev, &msm_drm_ops, match); + if (ret) + goto fail; - return component_master_add_with_match(&pdev->dev, &msm_drm_ops, match); + return 0; + +fail: + of_platform_depopulate(&pdev->dev); + return ret; } static int msm_pdev_remove(struct platform_device *pdev) -- 2.20.1