* re: drm/atomic: add commit_planes_on_crtc helper
@ 2015-05-20 19:43 Dan Carpenter
2015-05-21 8:29 ` Daniel Vetter
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2015-05-20 19:43 UTC (permalink / raw)
To: maarten.lankhorst; +Cc: dri-devel
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.
1245 crtc_funcs->atomic_flush(crtc);
1246 }
regards,
dan carpenter
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: drm/atomic: add commit_planes_on_crtc helper
2015-05-20 19:43 drm/atomic: add commit_planes_on_crtc helper Dan Carpenter
@ 2015-05-21 8:29 ` Daniel Vetter
0 siblings, 0 replies; 2+ messages in thread
From: Daniel Vetter @ 2015-05-21 8:29 UTC (permalink / raw)
To: Dan Carpenter; +Cc: dri-devel
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@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-05-21 8:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-20 19:43 drm/atomic: add commit_planes_on_crtc helper Dan Carpenter
2015-05-21 8:29 ` Daniel Vetter
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.