Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3099989ybi; Thu, 18 Jul 2019 21:02:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqyifMPoBCwVcpn/gQt2eXpZld7pUMs7rajeIZ+jH9rkYolHDkRUr1qtzUz7zT5VHqD7/4Ik X-Received: by 2002:a17:902:110b:: with SMTP id d11mr56653342pla.213.1563508923805; Thu, 18 Jul 2019 21:02:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563508923; cv=none; d=google.com; s=arc-20160816; b=X8vztvwQNUrZxewXyMq/3/ZFlhAK6/5SFQ4Bs8Lj5DGVykyzoGUZ+oRmrStGvRKkJc nM5ZRbRhsp7iZW4vu0Xbq4eLe5M10w2mmeTxpMPDlu5eliT6NsiUvC9Mohlr+NohF4+n tinex9SrmEbqhdBp13qEEHQaFp+JUsFvmeqgimEf1M6+VQMkjuVzBrRAhZzA9IIlp6VW 0YQMFUD0WMxbt0Hpk5thXYxEheobWJ9am8/KGINkYb7jNA/g78ZWV0DoEq5whesWfeHp Hqhf+ZXdHmuY/+f93GVQ2uPppJpy2rdWLSDcZS6oohCTbeeIn29wWFdlIPUjtqlWsQjS fm9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=aVcmdERfC1HyqJfw6j5aOmZ06e8RlyzOo3Y0NSfSCZQ=; b=VFLawSBx3KyCf561Wskjtmj256PFy0YSvvrGM3VrkSECuY8/q9ZgJcI62kwHn3f7pS QuU5y1Te3nmrntOkfBJzxrdNyj8VGjwoGeP4J1me7IyZ6IqzvmI9CYNua114+BBLOnsu cJdkoifEUtC2EzyKhKJHgsgmzdeVITaAJwdJpcF4nvufedkNxb5cZhj+B/d9vpU4nNXv hPeQT6eg+NhwgeubovMahVFyLA3Dm1ZKXMnmINu5DmdUGxiMNII7EHR09TUKDX6hWZCe N7oX5DgQJ+obUxw/iM0pYeyRxIYsCqMqPmU057Y0FUIWAyX27Nf+vouZsJrdvCKmICGq s1Rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=04CQa0Nk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y12si3058026pgg.585.2019.07.18.21.01.48; Thu, 18 Jul 2019 21:02:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=04CQa0Nk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1728746AbfGSD73 (ORCPT + 99 others); Thu, 18 Jul 2019 23:59:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:59034 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728713AbfGSD71 (ORCPT ); Thu, 18 Jul 2019 23:59:27 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E75A32189E; Fri, 19 Jul 2019 03:59:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563508766; bh=IbPNnL48G2wmx8OJhUiOUoTLQOe/PDac/dWk7pRo+FQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=04CQa0NkZh2PLulb9hMPLXHISNfoR2wze1IMfhohf0swcMpW0A/8GCntHd9oCO1uo A4VHZDOKl142W/Z1T8clYKusXCfhRzTY1omdIv52fjJRw1Be9MS6GebNI9z59SsHIE 6kCqdqzDliQC9ZYezsptTzYfXBqve2tGVUWMZm+I= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Sean Paul , Rob Clark , Sasha Levin , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH AUTOSEL 5.2 078/171] drm/msm: Depopulate platform on probe failure Date: Thu, 18 Jul 2019 23:55:09 -0400 Message-Id: <20190719035643.14300-78-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190719035643.14300-1-sashal@kernel.org> References: <20190719035643.14300-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sean Paul [ 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