From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolin Chen Subject: [PATCH] drm/tegra: hub: Do not enable orphaned window group Date: Tue, 19 May 2020 02:03:01 -0700 Message-ID: <20200519090301.32689-1-nicoleotsuka@gmail.com> Return-path: Sender: linux-tegra-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Cc: airlied-cv59FeDIM0c@public.gmane.org, daniel-/w4YWyX8dFk@public.gmane.org, jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org, dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org, linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: linux-tegra@vger.kernel.org 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 --- 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 8183e617bf6b..a2ef8f218d4e 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.17.1 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.3 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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 6071DC433E0 for ; Wed, 20 May 2020 07:35:11 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 364B220756 for ; Wed, 20 May 2020 07:35:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gxVEiKnO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 364B220756 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5B4BB6E5B4; Wed, 20 May 2020 07:35:07 +0000 (UTC) Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by gabe.freedesktop.org (Postfix) with ESMTPS id 073476E2E9 for ; Tue, 19 May 2020 09:03:05 +0000 (UTC) Received: by mail-pg1-x544.google.com with SMTP id f6so6101188pgm.1 for ; Tue, 19 May 2020 02:03:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=g7l8f0Zv5HCPiGiqrR0/5unpKCy3N2qumpqSQ5QZRv0=; b=gxVEiKnOHOpzOMXUCO9AgTFR22gtEofog93jxkLur8uXfyuNpzgdZgCu3EOHfO9WOd 0cL7wt4UUibv9MBJafxdPTHN/RfQoO4vj/YedXi8+hmwEoSmkuzzJJoFKLBuKCSc4BrS yPTZjpa6RBovbwSNwyowJyjwwyk/tcLCs41eLCAB6iuD/o2z1RlRZ63TtXtAYlGMvgFc quh0GXOlj/vK+QcvBfttYKm6KlfCECFdW/lIoSlNDFy4srlxabF0n3c7efj2p1V/YZyb Lx/WtWN5LPn/l74DI721wUsRc62KfXTbuIspRtQTL3Ez/foiRnn2u40HnRmnXv1g7lki Q4aA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=g7l8f0Zv5HCPiGiqrR0/5unpKCy3N2qumpqSQ5QZRv0=; b=MTlkMhSkGeooCWSd7T12yBIDBuFWd+9HR5dm/BIYEqLcOyrXIiYQuGzQfhSKtW4kIi szgQYMBDf1dWQns+BwEvY/BD7CfXlEML0SUrtR9jENBujlaXalInU+58jblgqyWJXERO sxmsbP3LEtgukL4+H9R+6CpKfOAEpIfOJj4ZZZOWjBYWDMJWeBcL0oF64qT5maamvpOv 02EO/UQ/dL6mTyl7C0p4uUKfDGIwf+W0P8c0uM/1a20O8YhYlxWSWR1J/QcuXjBGoOBg JZfZelbhqP9jkpuiORnPU5wMp+P+37+UKLXoexEqK+Nd2ZA+wuCSWEV+1AnGrI9YJagc YnaQ== X-Gm-Message-State: AOAM532MB4/1VY6qRB6jRC2xsjqsqj9IIZ7Dhs6qZaP7t3U9gXJjGBrS 2tDgfxW1J2l7vCNjMmboEaw= X-Google-Smtp-Source: ABdhPJzb0ZYQ3HiDvsOVxjLFhTBa2u5r+klKCMhULaQYcLI8QEUl5NNR9NwoIW5wXqC85Fj8q6UQGw== X-Received: by 2002:aa7:8c53:: with SMTP id e19mr16678053pfd.264.1589878984490; Tue, 19 May 2020 02:03:04 -0700 (PDT) Received: from Asurada-Nvidia.nvidia.com (searspoint.nvidia.com. [216.228.112.21]) by smtp.gmail.com with ESMTPSA id i128sm10843094pfc.149.2020.05.19.02.03.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 02:03:04 -0700 (PDT) From: Nicolin Chen To: thierry.reding@gmail.com Subject: [PATCH] drm/tegra: hub: Do not enable orphaned window group Date: Tue, 19 May 2020 02:03:01 -0700 Message-Id: <20200519090301.32689-1-nicoleotsuka@gmail.com> X-Mailer: git-send-email 2.17.1 X-Mailman-Approved-At: Wed, 20 May 2020 07:34:33 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: airlied@linux.ie, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, jonathanh@nvidia.com, linux-tegra@vger.kernel.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 --- 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 8183e617bf6b..a2ef8f218d4e 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.17.1 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel 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.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 00C37C433DF for ; Tue, 19 May 2020 09:03:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C76D6208A7 for ; Tue, 19 May 2020 09:03:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gxVEiKnO" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728286AbgESJDF (ORCPT ); Tue, 19 May 2020 05:03:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726333AbgESJDF (ORCPT ); Tue, 19 May 2020 05:03:05 -0400 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10501C061A0C; Tue, 19 May 2020 02:03:05 -0700 (PDT) Received: by mail-pf1-x444.google.com with SMTP id 23so6219698pfy.8; Tue, 19 May 2020 02:03:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=g7l8f0Zv5HCPiGiqrR0/5unpKCy3N2qumpqSQ5QZRv0=; b=gxVEiKnOHOpzOMXUCO9AgTFR22gtEofog93jxkLur8uXfyuNpzgdZgCu3EOHfO9WOd 0cL7wt4UUibv9MBJafxdPTHN/RfQoO4vj/YedXi8+hmwEoSmkuzzJJoFKLBuKCSc4BrS yPTZjpa6RBovbwSNwyowJyjwwyk/tcLCs41eLCAB6iuD/o2z1RlRZ63TtXtAYlGMvgFc quh0GXOlj/vK+QcvBfttYKm6KlfCECFdW/lIoSlNDFy4srlxabF0n3c7efj2p1V/YZyb Lx/WtWN5LPn/l74DI721wUsRc62KfXTbuIspRtQTL3Ez/foiRnn2u40HnRmnXv1g7lki Q4aA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=g7l8f0Zv5HCPiGiqrR0/5unpKCy3N2qumpqSQ5QZRv0=; b=evw/Akxro/w5EUyJBHfD6LYH+0xOAwBP8xx66dQeQXL1rpN+8kx+qbTBTkMeFsFIVB OLBcqNyduZ+yU4otXUqhdKbiDLgXgHg7qEQsnzzRxeBGiVZNhKLcPGyIgRYf4bEfL2rn ZtF82mv+MCXuikuv8YWDhOi2F2zzxfVkGvrYI/CCifHeXhvquPnKh+/Vm36v7GGTuv1g lH2Acl8jZoUpUMD5luX/XP44UPVTs3iRdSfBktP6DfPEVMJURm85kLRzUUyXXeHjTBIq e8z7uY2Ovv8BgVenupcFKpygS+7wKT99J9lUNSv42dLS9GiSVf2BVbykGACxEcyYXmgI R63A== X-Gm-Message-State: AOAM530Q8s0UG1npE5eerTBln2BqfpjO6cHNYpJ7u2XoPaxiHdytXfP8 SEl8KoVudWGLcQIRA1013T24qoD5lVM= X-Google-Smtp-Source: ABdhPJzb0ZYQ3HiDvsOVxjLFhTBa2u5r+klKCMhULaQYcLI8QEUl5NNR9NwoIW5wXqC85Fj8q6UQGw== X-Received: by 2002:aa7:8c53:: with SMTP id e19mr16678053pfd.264.1589878984490; Tue, 19 May 2020 02:03:04 -0700 (PDT) Received: from Asurada-Nvidia.nvidia.com (searspoint.nvidia.com. [216.228.112.21]) by smtp.gmail.com with ESMTPSA id i128sm10843094pfc.149.2020.05.19.02.03.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 02:03:04 -0700 (PDT) From: Nicolin Chen To: thierry.reding@gmail.com Cc: airlied@linux.ie, daniel@ffwll.ch, jonathanh@nvidia.com, dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] drm/tegra: hub: Do not enable orphaned window group Date: Tue, 19 May 2020 02:03:01 -0700 Message-Id: <20200519090301.32689-1-nicoleotsuka@gmail.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 8183e617bf6b..a2ef8f218d4e 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.17.1