Skip to content

Commit

Permalink
drm/tegra: Make CRTC upcasting safer
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Thierry Reding committed Dec 3, 2013
1 parent 43dd555 commit 3782651
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/gpu/drm/tegra/drm.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 3782651

Please sign in to comment.