summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/tegra/drm.h
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2013-11-08 11:30:37 (GMT)
committerThierry Reding <treding@nvidia.com>2013-12-03 09:04:15 (GMT)
commit37826519c4dca037bda5d008b4d687c2e6f8d405 (patch)
treea3906601434c9cad929cf37ab6545d86e393c0f2 /drivers/gpu/drm/tegra/drm.h
parent43dd5554fc4e0aa3c29df24aa9dbc7a610fb9e36 (diff)
downloadlinux-37826519c4dca037bda5d008b4d687c2e6f8d405.tar.xz
drm/tegra: Make CRTC upcasting safer
When upcasting a NULL CRTC object, propagate the NULL pointer instead of some invalid pointer. This allows subsequent code to check that the cast object is valid. Signed-off-by: Thierry Reding <treding@nvidia.com>
Diffstat (limited to 'drivers/gpu/drm/tegra/drm.h')
-rw-r--r--drivers/gpu/drm/tegra/drm.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpu/drm/tegra/drm.h b/drivers/gpu/drm/tegra/drm.h
index fdfe259..7da0b92 100644
--- a/drivers/gpu/drm/tegra/drm.h
+++ b/drivers/gpu/drm/tegra/drm.h
@@ -116,7 +116,7 @@ host1x_client_to_dc(struct host1x_client *client)
static inline struct tegra_dc *to_tegra_dc(struct drm_crtc *crtc)
{
- return container_of(crtc, struct tegra_dc, base);
+ return crtc ? container_of(crtc, struct tegra_dc, base) : NULL;
}
static inline void tegra_dc_writel(struct tegra_dc *dc, unsigned long value,