Re: [Intel-gfx] [PATCH] i915: don't call drm_atomic_state_put on invalid pointer

From: Daniel Vetter
Date: Wed Oct 19 2016 - 10:49:07 EST


On Tue, Oct 18, 2016 at 04:56:02PM +0100, Chris Wilson wrote:
> On Tue, Oct 18, 2016 at 05:16:23PM +0200, Arnd Bergmann wrote:
> > The introduction of reference counting on the state structures caused
> > sanitize_watermarks() in i915 to break in the error handling case,
> > as pointed out by gcc -Wmaybe-uninitialized
> >
> > drivers/gpu/drm/i915/intel_display.c: In function âintel_modeset_initâ:
> > include/drm/drm_atomic.h:224:2: error: âstateâ may be used uninitialized in this function [-Werror=maybe-uninitialized]
> >
> > This changes the function back to only drop the reference count
> > when it was successfully allocated first.
> >
> > Fixes: 0853695c3ba4 ("drm: Add reference counting to drm_atomic_state")
> > Cc: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
> > Cc: Daniel Vetter <daniel.vetter@xxxxxxxx>
> > Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
>
> Yup, missed that it jumps to fail before allocating state.
>
> Function still looks a bit odd, but nvm
> Reviewed-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>

Applied to drm-misc, thanks for the patch&review.
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch