Skip to contentSkip to conversation

drm/atomic: add commit_planes_on_crtc helper

DISCUSSION Dan Carpenter 2 participants 2 messages May 20, 2015 – May 21, 2015

lore
Share & tools
lore
#0 lore raw

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
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#1 lore raw
Quoted 39 lines · Dan Carpenter

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)

Quoted 2 lines
                    ^^^^^^^^^^

Unchecked dereference.

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

Quoted 10 lines
  1245			crtc_funcs->atomic_flush(crtc);
  1246	}

regards,
dan carpenter
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel