[Intel-gfx] [PATCH] drm/i915: Initialise subslice prior to potential zero-length loop

Chris Wilson chris at chris-wilson.co.uk
Wed May 29 11:24:20 UTC 2019


Appease static analysers by making sure subslice always have a value.

drivers/gpu/drm/i915//gt/intel_engine_cs.c:971 intel_sseu_fls_subslice() error: uninitialized symbol 'subslice'.

There's also the nagging question of whether that fls() is off-by-one...

Fixes: 1ac159e23c2c ("drm/i915: Expand subslice mask")
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio at intel.com>
Cc: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Cc: Stuart Summers <stuart.summers at intel.com>
Cc: Manasi Navare <manasi.d.navare at intel.com>
---
 drivers/gpu/drm/i915/gt/intel_engine_cs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_engine_cs.c b/drivers/gpu/drm/i915/gt/intel_engine_cs.c
index 158722b50691..fc880424be2f 100644
--- a/drivers/gpu/drm/i915/gt/intel_engine_cs.c
+++ b/drivers/gpu/drm/i915/gt/intel_engine_cs.c
@@ -956,12 +956,12 @@ const char *i915_cache_level_str(struct drm_i915_private *i915, int type)
 static inline u32
 intel_sseu_fls_subslice(const struct sseu_dev_info *sseu, u32 slice)
 {
-	u32 subslice;
+	const u8 *subslice_mask = sseu->subslice_mask + slice * sseu->ss_stride;
+	u32 subslice = 0;
 	int i;
 
 	for (i = sseu->ss_stride - 1; i >= 0; i--) {
-		subslice = fls(sseu->subslice_mask[slice * sseu->ss_stride +
-						   i]);
+		subslice = fls(subslice_mask[i]);
 		if (subslice) {
 			subslice += i * BITS_PER_BYTE;
 			break;
-- 
2.20.1



More information about the Intel-gfx mailing list