From 0e870bf872929a026c58a74608734b89a95dda74 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Tue, 7 Nov 2017 13:53:24 +0000 Subject: [PATCH] drm/i915: Simplify onion for bxt_ddi_phy_init() Mime-version: 1.0 Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: 8bit Git-commit: 0e870bf872929a026c58a74608734b89a95dda74 Patch-mainline: v4.16-rc1 References: FATE#322643 bsc#1055900 Older compilers (gcc-4.9) are not as able to track uninitialised variables as well as more recent compilers. In particular, Drivers/gpu/drm/i915/intel_dpio_phy.c: In function ‘bxt_ddi_phy_init’: drivers/gpu/drm/i915/intel_dpio_phy.c:482:25: warning: ‘was_enabled’ may be used uninitialized in this function [-Wmaybe-uninitialized] In this case, we can rearrange code slightly to make the control flow clearer to the reader, as well as the compiler. That is we only call uninit using the same predicate as calling init Signed-off-by: Chris Wilson Cc: Ander Conselvan de Oliveira Cc: Imre Deak Link: https://patchwork.freedesktop.org/patch/msgid/20171107135324.28300-1-chris@chris-wilson.co.uk Reviewed-by: Gabriel Krisman Bertazi Acked-by: Takashi Iwai --- drivers/gpu/drm/i915/intel_dpio_phy.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) --- a/drivers/gpu/drm/i915/intel_dpio_phy.c +++ b/drivers/gpu/drm/i915/intel_dpio_phy.c @@ -466,21 +466,21 @@ void bxt_ddi_phy_init(struct drm_i915_pr lockdep_assert_held(&dev_priv->power_domains.lock); - if (rcomp_phy != -1) { + was_enabled = true; + if (rcomp_phy != -1) was_enabled = bxt_ddi_phy_is_enabled(dev_priv, rcomp_phy); - /* - * We need to copy the GRC calibration value from rcomp_phy, - * so make sure it's powered up. - */ - if (!was_enabled) - _bxt_ddi_phy_init(dev_priv, rcomp_phy); - } + /* + * We need to copy the GRC calibration value from rcomp_phy, + * so make sure it's powered up. + */ + if (!was_enabled) + _bxt_ddi_phy_init(dev_priv, rcomp_phy); _bxt_ddi_phy_init(dev_priv, phy); - if (rcomp_phy != -1 && !was_enabled) - bxt_ddi_phy_uninit(dev_priv, phy_info->rcomp_phy); + if (!was_enabled) + bxt_ddi_phy_uninit(dev_priv, rcomp_phy); } static bool __printf(6, 7)