All of lore.kernel.org
 help / color / mirror / Atom feed
* re: drm/atomic: track bitmask of planes attached to crtc
@ 2014-11-27  6:41 Dan Carpenter
  2014-11-27  9:55 ` Daniel Vetter
  0 siblings, 1 reply; 6+ messages in thread
From: Dan Carpenter @ 2014-11-27  6:41 UTC (permalink / raw)
  To: robdclark; +Cc: dri-devel

Hello Rob Clark,

The patch 1ed2f34b4cc0: "drm/atomic: track bitmask of planes attached
to crtc" from Nov 21, 2014, leads to the following static checker
warning:

	drivers/gpu/drm/drm_atomic.c:368 drm_atomic_set_crtc_for_plane()
	error: 'plane_state' dereferencing possible ERR_PTR()

drivers/gpu/drm/drm_atomic.c
   360  int
   361  drm_atomic_set_crtc_for_plane(struct drm_atomic_state *state,
   362                                struct drm_plane *plane, struct drm_crtc *crtc)
   363  {
   364          struct drm_plane_state *plane_state =
                                        ^^^^^^^^^^^^^
   365                          drm_atomic_get_plane_state(state, plane);
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
   366          struct drm_crtc_state *crtc_state;
   367  
   368          if (plane_state->crtc) {
                    ^^^^^^^^^^^^^^^^^
Missing IS_ERR() check.

Also drm_atomic_get_plane_state() has poor error handling.  In
drm_atomic_get_plane_state(), if the call to drm_atomic_get_plane_state()
fails then it leaks memory.

   369                  crtc_state = drm_atomic_get_crtc_state(plane_state->state,
   370                                                         plane_state->crtc);
   371                  if (WARN_ON(IS_ERR(crtc_state)))
   372                          return PTR_ERR(crtc_state);
   373  
   374                  crtc_state->plane_mask &= ~(1 << drm_plane_index(plane));
   375          }
   376  
   377          plane_state->crtc = crtc;
   378  

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] 6+ messages in thread

end of thread, other threads:[~2014-11-28 10:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-27  6:41 drm/atomic: track bitmask of planes attached to crtc Dan Carpenter
2014-11-27  9:55 ` Daniel Vetter
2014-11-27 15:54   ` Dan Carpenter
2014-11-27 17:11     ` Daniel Vetter
2014-11-27 20:04       ` Dan Carpenter
2014-11-28 10:39         ` 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.