diff mbox

[1/3] edid-decode: parse_cta: fix maybe uninitialized warning

Message ID 07a4901aea4f30db053028fd3a84806b7777ef64.1506443620.git.baruch@tkos.co.il (mailing list archive)
State New, archived
Headers show

Commit Message

Baruch Siach Sept. 26, 2017, 4:33 p.m. UTC
Fix the following warning:

edid-decode.c: In function ‘parse_cta’:
edid-decode.c:142:5: warning: ‘v’ may be used uninitialized in this function [-Wmaybe-uninitialized]

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
 edid-decode.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/edid-decode.c b/edid-decode.c
index 5592227d1db5..3df35ec6d07f 100644
--- a/edid-decode.c
+++ b/edid-decode.c
@@ -124,7 +124,7 @@  struct field {
 static void
 decode_value(struct field *field, int val, const char *prefix)
 {
-    struct value *v;
+    struct value *v = NULL;
     int i;
 
     for (i = 0; i < field->n_values; i++) {
@@ -139,7 +139,8 @@  decode_value(struct field *field, int val, const char *prefix)
        return;
     }
 
-    printf("%s%s: %s (%d)\n", prefix, field->name, v->description, val);
+    printf("%s%s: %s (%d)\n", prefix, field->name,
+         v ? v->description : "unknown", val);
 }
 
 static void