[v2,1/2] drm/tilcdc: Check drm_fb_cma_get_gem_obj() return value

Message ID 85da7112bfad2994c36ea52bbe58babd8ddb0bc9.1552495696.git.jsarha@ti.com
State New
Headers show
Series
  • drm/tilcdc: a cleanup and a fix
Related show

Commit Message

Jyri Sarha March 13, 2019, 5:25 p.m.
Clockwork, a static code analysis SW, complains about
drm_fb_cma_get_gem_obj() possibly returning NULL. This should never
happen with the frame-buffers used by tilcdc. However, returning null
is still a part of the drm_fb_cma_get_gem_obj() API, so lets make
Clockwork quiet by adding a simple check with WARN.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
---
 drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 2 ++
 1 file changed, 2 insertions(+)

Patch

diff --git a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
index 1067e702c22c..bc9f859f45dc 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
@@ -75,6 +75,8 @@  static void set_scanout(struct drm_crtc *crtc, struct drm_framebuffer *fb)
 	u64 dma_base_and_ceiling;
 
 	gem = drm_fb_cma_get_gem_obj(fb, 0);
+	if (WARN_ON(!gem)) /* Make Clockwork quiet. Should never happen. */
+		return;
 
 	start = gem->paddr + fb->offsets[0] +
 		crtc->y * fb->pitches[0] +