| From 35ccbf66ddf639b06ebdda3ffe46ba21d1a74e13 Mon Sep 17 00:00:00 2001 |
| From: Nicolin Chen <nicoleotsuka@gmail.com> |
| Date: Tue, 19 May 2020 02:03:01 -0700 |
| Subject: [PATCH] drm/tegra: hub: Do not enable orphaned window group |
| |
| commit ef4e417eb3ec7fe657928f10ac1d2154d8a5fb38 upstream. |
| |
| 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 <nicoleotsuka@gmail.com> |
| Signed-off-by: Thierry Reding <treding@nvidia.com> |
| Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> |
| |
| diff --git a/drivers/gpu/drm/tegra/hub.c b/drivers/gpu/drm/tegra/hub.c |
| index 92f202ec0577..706a494e1389 100644 |
| --- a/drivers/gpu/drm/tegra/hub.c |
| +++ b/drivers/gpu/drm/tegra/hub.c |
| @@ -140,7 +140,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; |
| @@ -157,7 +159,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.27.0 |
| |