Quoting Arnd Bergmann (2018-03-13 16:19:31)
The conditional spinlock confuses gcc into thinking the 'flags' value might contain uninitialized data:
drivers/gpu/drm/i915/i915_pmu.c: In function '__i915_pmu_event_read': arch/x86/include/asm/paravirt_types.h:573:3: error: 'flags' may be used uninitialized in this function [-Werror=maybe-uninitialized]
The code is correct, but it's easy to see how the compiler gets confused here. This avoids the problem by pulling the lock outside of the function into its only caller.
Fixes: 1fe699e30113 ("drm/i915/pmu: Fix sleep under atomic in RC6 readout") Signed-off-by: Arnd Bergmann arnd@arndb.de
Reviewed-by: Chris Wilson chris@chris-wilson.co.uk -Chris