[cairo] [PATCH v8 68/71] drm: i915: fixed uninitialized variable warning for dest_reg

Enrico Weigelt, metux IT consult enrico.weigelt at gr13.net
Thu Jun 30 15:46:46 UTC 2016


Signed-off-by: Enrico Weigelt, metux IT consult <enrico.weigelt at gr13.net>
---
 src/drm/cairo-drm-i915-shader.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/drm/cairo-drm-i915-shader.c b/src/drm/cairo-drm-i915-shader.c
index 0205739..b5b2459 100644
--- a/src/drm/cairo-drm-i915-shader.c
+++ b/src/drm/cairo-drm-i915-shader.c
@@ -911,6 +911,16 @@ i915_set_shader_program (i915_device_t *device,
 	    break;
 	}
     }
+    else
+    {
+	/* make the compiler happy - fix warning on unused variable.
+	   we could simply assign an init value on declaration, but
+	   this way it's more robust against possible future changes
+	   to this code (otherwise potentially newly introduced
+	   unitialized variable issues could easily become unnoticed.
+	*/
+	dest_reg = 0;
+    }
 
     if (shader->clip.type.fragment == FS_TEXTURE) {
 	assert (mask_reg != ~0U);
-- 
2.6.4.442.g545299f



More information about the cairo mailing list