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

Enrico Weigelt, metux IT consult enrico.weigelt at gr13.net
Mon Apr 17 16:57:43 UTC 2017


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 020573921..b5b245952 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.11.0.rc0.7.gbe5a750



More information about the cairo mailing list