[Intel-gfx] [PATCH] drm/i915: Silence compiler warning
Daniel Vetter
daniel at ffwll.ch
Fri May 29 10:06:33 PDT 2015
On Fri, May 29, 2015 at 02:28:09PM +0300, Ander Conselvan de Oliveira wrote:
> Silence the following -Wmaybe-uninitialized warnings and make the code
> more clear.
>
> drivers/gpu/drm/i915/intel_display.c: In function ‘__intel_set_mode’:
> drivers/gpu/drm/i915/intel_display.c:11844:14: warning: ‘crtc_state’ may be used uninitialized in this function [-Wmaybe-uninitialized]
> return state->mode_changed || state->active_changed;
> ^
> drivers/gpu/drm/i915/intel_display.c:11854:25: note: ‘crtc_state’ was declared here
> struct drm_crtc_state *crtc_state;
> ^
> drivers/gpu/drm/i915/intel_display.c:11868:6: warning: ‘crtc’ may be used uninitialized in this function [-Wmaybe-uninitialized]
> if (crtc != intel_encoder->base.crtc)
> ^
> drivers/gpu/drm/i915/intel_display.c:11853:19: note: ‘crtc’ was declared here
> struct drm_crtc *crtc;
>
> Reported-by: Chris Wilson <chris at chris-wilson.co.uk>
> Suggested-by: Chris Wilson <chris at chris-wilson.co.uk>
> Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira at intel.com>
Queued for -next, thanks for the patch.
-Daniel
> ---
> drivers/gpu/drm/i915/intel_display.c | 42 ++++++++++++++++++------------------
> 1 file changed, 21 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index c392e58..ee3adb3 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -11861,15 +11861,15 @@ intel_modeset_update_state(struct drm_atomic_state *state)
> if (!intel_encoder->base.crtc)
> continue;
>
> - for_each_crtc_in_state(state, crtc, crtc_state, i)
> - if (crtc == intel_encoder->base.crtc)
> - break;
> + for_each_crtc_in_state(state, crtc, crtc_state, i) {
> + if (crtc != intel_encoder->base.crtc)
> + continue;
>
> - if (crtc != intel_encoder->base.crtc)
> - continue;
> + if (crtc_state->enable && needs_modeset(crtc_state))
> + intel_encoder->connectors_active = false;
>
> - if (crtc_state->enable && needs_modeset(crtc_state))
> - intel_encoder->connectors_active = false;
> + break;
> + }
> }
>
> drm_atomic_helper_swap_state(state->dev, state);
> @@ -11884,24 +11884,24 @@ intel_modeset_update_state(struct drm_atomic_state *state)
> if (!connector->encoder || !connector->encoder->crtc)
> continue;
>
> - for_each_crtc_in_state(state, crtc, crtc_state, i)
> - if (crtc == connector->encoder->crtc)
> - break;
> + for_each_crtc_in_state(state, crtc, crtc_state, i) {
> + if (crtc != connector->encoder->crtc)
> + continue;
>
> - if (crtc != connector->encoder->crtc)
> - continue;
> + if (crtc->state->enable && needs_modeset(crtc->state)) {
> + struct drm_property *dpms_property =
> + dev->mode_config.dpms_property;
>
> - if (crtc->state->enable && needs_modeset(crtc->state)) {
> - struct drm_property *dpms_property =
> - dev->mode_config.dpms_property;
> + connector->dpms = DRM_MODE_DPMS_ON;
> + drm_object_property_set_value(&connector->base,
> + dpms_property,
> + DRM_MODE_DPMS_ON);
>
> - connector->dpms = DRM_MODE_DPMS_ON;
> - drm_object_property_set_value(&connector->base,
> - dpms_property,
> - DRM_MODE_DPMS_ON);
> + intel_encoder = to_intel_encoder(connector->encoder);
> + intel_encoder->connectors_active = true;
> + }
>
> - intel_encoder = to_intel_encoder(connector->encoder);
> - intel_encoder->connectors_active = true;
> + break;
> }
> }
>
> --
> 2.1.0
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
More information about the Intel-gfx
mailing list