Commit ef4e417e authored by Nicolin Chen's avatar Nicolin Chen Committed by Thierry Reding

drm/tegra: hub: Do not enable orphaned window group

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: default avatarNicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
parent 109be8b2
...@@ -149,7 +149,9 @@ int tegra_display_hub_prepare(struct tegra_display_hub *hub) ...@@ -149,7 +149,9 @@ int tegra_display_hub_prepare(struct tegra_display_hub *hub)
for (i = 0; i < hub->soc->num_wgrps; i++) { for (i = 0; i < hub->soc->num_wgrps; i++) {
struct tegra_windowgroup *wgrp = &hub->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; return 0;
...@@ -166,7 +168,9 @@ void tegra_display_hub_cleanup(struct tegra_display_hub *hub) ...@@ -166,7 +168,9 @@ void tegra_display_hub_cleanup(struct tegra_display_hub *hub)
for (i = 0; i < hub->soc->num_wgrps; i++) { for (i = 0; i < hub->soc->num_wgrps; i++) {
struct tegra_windowgroup *wgrp = &hub->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);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment