On Fri, Mar 27, 2015 at 05:33:00PM +0300, Dan Carpenter wrote:
> Hello Daniel Vetter,
> 
> This is a semi-automatic email about new static checker warnings.
> 
> The patch 76b58b03806b: "drm/atomic-helpers: Properly avoid full 
> modeset dance" from Mar 26, 2015, leads to the following Smatch 
> complaint:
> 
> drivers/gpu/drm/drm_atomic_helper.c:615 disable_outputs()
>        warn: variable dereferenced before check 'connector->state->crtc' (see 
> line 591)
> 
> drivers/gpu/drm/drm_atomic_helper.c
>    590                        if (!old_crtc_state->active ||
>    591                            
> !needs_modeset(connector->state->crtc->state))
>                                            ^^^^^^^^^^^^^^^^^^^^^^
> Patch introduces a new dereference.
> 
>    592                                continue;
>    593        
>    594                        encoder = old_conn_state->best_encoder;
>    595        
>    596                        /* We shouldn't get this far if we didn't 
> previously have
>    597                         * an encoder.. but WARN_ON() rather than 
> explode.
>    598                         */
>    599                        if (WARN_ON(!encoder))
>    600                                continue;
>    601        
>    602                        funcs = encoder->helper_private;
>    603        
>    604                        DRM_DEBUG_ATOMIC("disabling [ENCODER:%d:%s]\n",
>    605                                         encoder->base.id, 
> encoder->name);
>    606        
>    607                        /*
>    608                         * Each encoder has at most one connector 
> (since we always steal
>    609                         * it away), so we won't call disable hooks 
> twice.
>    610                         */
>    611                        if (encoder->bridge)
>    612                                
> encoder->bridge->funcs->disable(encoder->bridge);
>    613        
>    614                        /* Right function depends upon target state. */
>    615                        if (connector->state->crtc && funcs->prepare)
>                             ^^^^^^^^^^^^^^^^^^^^^^
> Existing code checks for NULL.
> 
>    616                                funcs->prepare(encoder);
>    617                        else if (funcs->disable)

Thierry was a notch faster with reporting this on irc, already fixed.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

Reply via email to