Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>

authored by

Nicolin Chen and committed by
Thierry Reding
ef4e417e 109be8b2

+6 -2
+6 -2
drivers/gpu/drm/tegra/hub.c
··· 149 149 for (i = 0; i < hub->soc->num_wgrps; i++) { 150 150 struct tegra_windowgroup *wgrp = &hub->wgrps[i]; 151 151 152 - tegra_windowgroup_enable(wgrp); 152 + /* Skip orphaned window group whose parent DC is disabled */ 153 + if (wgrp->parent) 154 + tegra_windowgroup_enable(wgrp); 153 155 } 154 156 155 157 return 0; ··· 168 166 for (i = 0; i < hub->soc->num_wgrps; i++) { 169 167 struct tegra_windowgroup *wgrp = &hub->wgrps[i]; 170 168 171 - tegra_windowgroup_disable(wgrp); 169 + /* Skip orphaned window group whose parent DC is disabled */ 170 + if (wgrp->parent) 171 + tegra_windowgroup_disable(wgrp); 172 172 } 173 173 } 174 174