Skip to contentSkip to conversation

drm/i915: fix warn, struct may be used uninitialized

PATCH In review Christoph Fritz 2 participants 3 messages Jun 16, 2010 – Jul 1, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: fix warn, struct may be used uninitialized

In function ‘i915_setup_compression’:
warning: ‘compressed_llb’ may be used uninitialized in this function

---
 drivers/gpu/drm/i915/i915_dma.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/gpu/drm/i915/i915_dma.c +2 -1
index 59a2bf8..772a72a 100644
@@ -1229,7 +1229,8 @@ static void i915_warn_stolen(struct drm_device *dev)
 static void i915_setup_compression(struct drm_device *dev, int size)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
-	struct drm_mm_node *compressed_fb, *compressed_llb;
+	struct drm_mm_node *compressed_fb;
+	struct drm_mm_node *compressed_llb;
 	unsigned long cfb_base;
 	unsigned long ll_base = 0;
 
Signature · 1 line
1.7.1
#1 lore raw

I meant to send the following patch.

Thanks for pointing out,
chf

---
In function ‘i915_setup_compression’:
warning: ‘compressed_llb’ may be used uninitialized in this function

this modifies the topology of the function a bit

---
 drivers/gpu/drm/i915/i915_dma.c |   15 ++++++---------
 1 files changed, 6 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/i915_dma.c +6 -9
index 59a2bf8..17b5dc8 100644
@@ -1274,21 +1274,18 @@ static void i915_setup_compression(struct drm_device *dev, int size)
 			drm_mm_put_block(compressed_fb);
 			drm_mm_put_block(compressed_llb);
 		}
-	}
-
-	dev_priv->cfb_size = size;
 
-	intel_disable_fbc(dev);
-	dev_priv->compressed_fb = compressed_fb;
-
-	if (IS_GM45(dev)) {
-		I915_WRITE(DPFC_CB_BASE, compressed_fb->start);
-	} else {
 		I915_WRITE(FBC_CFB_BASE, cfb_base);
 		I915_WRITE(FBC_LL_BASE, ll_base);
 		dev_priv->compressed_llb = compressed_llb;
+	} else {
+		I915_WRITE(DPFC_CB_BASE, compressed_fb->start);
 	}
 
+	dev_priv->cfb_size = size;
+	intel_disable_fbc(dev);
+	dev_priv->compressed_fb = compressed_fb;
+
 	DRM_DEBUG("FBC base 0x%08lx, ll base 0x%08lx, size %dM\n", cfb_base,
 		  ll_base, size >> 20);
 }
Signature · 1 line
1.7.1
#2 lore raw
In reply to Christoph Fritz
Quoted 4 lines · Christoph Fritz

I meant to send the following patch.

Thanks for pointing out,
chf

I went with a simpler one from another submitter that didn't change the structure of the function.