drm/atomic: add commit_planes_on_crtc helper

Daniel Vetter daniel at ffwll.ch
Thu May 21 01:29:36 PDT 2015


On Wed, May 20, 2015 at 10:43:55PM +0300, Dan Carpenter wrote:
> Hello Maarten Lankhorst,
> 
> This is a semi-automatic email about new static checker warnings.
> 
> The patch 32975e952e85: "drm/atomic: add commit_planes_on_crtc 
> helper" from May 19, 2015, leads to the following Smatch complaint:
> 
> drivers/gpu/drm/drm_atomic_helper.c:1244 drm_atomic_helper_commit_planes_on_crtc()
> 	 error: we previously assumed 'crtc_funcs' could be null (see line 1221)
> 
> drivers/gpu/drm/drm_atomic_helper.c
>   1220		crtc_funcs = crtc->helper_private;
>   1221		if (crtc_funcs && crtc_funcs->atomic_begin)
>                     ^^^^^^^^^^
> Check.
> 
>   1222			crtc_funcs->atomic_begin(crtc);
>   1223	
>   1224		drm_for_each_plane_mask(plane, crtc->dev, plane_mask) {
>   1225			struct drm_plane_state *old_plane_state =
>   1226				drm_atomic_get_existing_plane_state(old_state, plane);
>   1227			const struct drm_plane_helper_funcs *plane_funcs;
>   1228	
>   1229			plane_funcs = plane->helper_private;
>   1230	
>   1231			if (!old_plane_state || !plane_funcs)
>   1232				continue;
>   1233	
>   1234			WARN_ON(plane->state->crtc && plane->state->crtc != crtc);
>   1235	
>   1236			if (drm_atomic_plane_disabling(plane, old_plane_state) &&
>   1237			    plane_funcs->atomic_disable)
>   1238				plane_funcs->atomic_disable(plane, old_plane_state);
>   1239			else if (plane->state->crtc ||
>   1240				 drm_atomic_plane_disabling(plane, old_plane_state))
>   1241				plane_funcs->atomic_update(plane, old_plane_state);
>   1242		}
>   1243	
>   1244		if (crtc_funcs->atomic_flush)
>                     ^^^^^^^^^^
> Unchecked dereference.

Indeed, thanks for the report. I've squashed in a small fixup.
-Daniel

> 
>   1245			crtc_funcs->atomic_flush(crtc);
>   1246	}
> 
> regards,
> dan carpenter
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the dri-devel mailing list