Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1083039ybt; Wed, 1 Jul 2020 18:26:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwziipEEFurN2hjjCxxtWFPjiDtRl6UgQ0PRSxZ2qfDkayqY3tPGsU7Wqg1aXHBYNLv4s83 X-Received: by 2002:aa7:c655:: with SMTP id z21mr32329776edr.330.1593653165799; Wed, 01 Jul 2020 18:26:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593653165; cv=none; d=google.com; s=arc-20160816; b=GgOsI8C1+3eQZDfq8Z09TxfMEhEQnIQBw1iifQTtdooAn7cqJ9rNjjDJray6VGV0oH A0lzq5iYsJQ9Jwji3NZP2htbhy8naGXl/bekbE0fQKn1N3Rm0OWaBQT9kMix3pV+D8qU HrBy8OIEzvcXhttnDLDsNAdDC3un5ug44KvhN0UjidmKFlYPbFIARyzSLaIzQUa93Ri7 x16GnR/hGgCwkGk637fRVk7X4vWDJoq0B5qeZs2F/zi1ljkPU2pgxCj0kDw6swTqNh+J XSe+lnjjAfcBmhcXpDkPPVxU1765fHbkw7FavPe+Uc9r94d+tMyYsp8wWgNDSADqk+KF UO+w== 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=Yvgk6ns1eT4smB3zNb6UgRIoOus1/3kgJ6mmkPt45L4=; b=seihmTmjLsBv4uY6jHkhIVYFUBxz7mQp7dPQFTQuqg1Qmo4i2dgl7MHmVICDbmugmB fn/HLmEfJoG+CjP17DMP4dOsINpg9MYBCizzWXx4P9kOLxxRZXuYpX3WfqeZ8LvQzXuy t3oKWqMWecFtp41nIXUlVT8Eq3/XJHWHGAt00CESRFiT0j6YP+7zxI0RFgKJ40BINOlk SfTlThgiLE7FQjBighCrrPiqTlWGVM4mkII3uLEZJGKVaojvYMK2bzFNeY9iCoNmSTxN 9SKrwrSDbj1fKPTe2aJ1J5ZPW0HKC05md/Pc3pbeaU47I9gFquvva3HWNgr2hoPSB6rT UlxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Y7tQ8Ndq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id nk6si4945329ejb.171.2020.07.01.18.25.42; Wed, 01 Jul 2020 18:26:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Y7tQ8Ndq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1728247AbgGBBXO (ORCPT + 99 others); Wed, 1 Jul 2020 21:23:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:53412 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728197AbgGBBXG (ORCPT ); Wed, 1 Jul 2020 21:23:06 -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 7FC6D2083E; Thu, 2 Jul 2020 01:23:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593652986; bh=YLtzimeikThgMm92AmIeJHSv55DRFKGTackCYTrPO+U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y7tQ8NdqTd8Hq5EEl+kGz2KsDUOQLB54eszVF8izUP2ZbWeW6wC2p9ezrnOm/fa71 c08T1s+3bPnMB8kx89K9GRfqpeyUYtEszYA0L0Z9YCeBnJoSMQ+9ig8SeKSND7prnG JRBAuuhqtZMgU/Ktgf9MrGl00Q7Hi82hHnNlGmBI= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Nicolin Chen , Thierry Reding , Sasha Levin , dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org Subject: [PATCH AUTOSEL 5.7 09/53] drm/tegra: hub: Do not enable orphaned window group Date: Wed, 1 Jul 2020 21:21:18 -0400 Message-Id: <20200702012202.2700645-9-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200702012202.2700645-1-sashal@kernel.org> References: <20200702012202.2700645-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: Nicolin Chen [ Upstream commit ef4e417eb3ec7fe657928f10ac1d2154d8a5fb38 ] Though the unconditional enable/disable code is not a final solution, we don't want to run into a NULL pointer situation when window group doesn't link to its DC parent if the DC is disabled in Device Tree. So this patch simply adds a check to make sure that window group has a valid parent before running into tegra_windowgroup_enable/disable. Signed-off-by: Nicolin Chen Signed-off-by: Thierry Reding Signed-off-by: Sasha Levin --- drivers/gpu/drm/tegra/hub.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/tegra/hub.c b/drivers/gpu/drm/tegra/hub.c index 8183e617bf6b8..a2ef8f218d4ec 100644 --- a/drivers/gpu/drm/tegra/hub.c +++ b/drivers/gpu/drm/tegra/hub.c @@ -149,7 +149,9 @@ int tegra_display_hub_prepare(struct tegra_display_hub *hub) for (i = 0; i < hub->soc->num_wgrps; i++) { struct tegra_windowgroup *wgrp = &hub->wgrps[i]; - tegra_windowgroup_enable(wgrp); + /* Skip orphaned window group whose parent DC is disabled */ + if (wgrp->parent) + tegra_windowgroup_enable(wgrp); } return 0; @@ -166,7 +168,9 @@ void tegra_display_hub_cleanup(struct tegra_display_hub *hub) for (i = 0; i < hub->soc->num_wgrps; i++) { struct tegra_windowgroup *wgrp = &hub->wgrps[i]; - tegra_windowgroup_disable(wgrp); + /* Skip orphaned window group whose parent DC is disabled */ + if (wgrp->parent) + tegra_windowgroup_disable(wgrp); } } -- 2.25.1