[coreboot-gerrit] New patch to review for coreboot: intel/skylake: Fix uninitialized variable warning

Martin Roth (martinroth@google.com) gerrit at coreboot.org
Sat Jan 16 18:14:04 CET 2016


Martin Roth (martinroth at google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13021

-gerrit

commit 1ac308a8a831b8c84c595821d5e1b14cd2adc98e
Author: Martin Roth <martinroth at google.com>
Date:   Sat Jan 16 09:22:22 2016 -0700

    intel/skylake: Fix uninitialized variable warning
    
    I don't think the warning is valid, because we already verify
    that num_channels is 2 or 4 as soon as we enter the function.
    Adding the default case makes the compiler happy.
    
    Fixes warning:
    src/soc/intel/skylake/nhlt/dmic.c: In function 'nhlt_soc_add_dmic_array':
    src/soc/intel/skylake/nhlt/dmic.c:100:2: error: 'formats' may be used
    uninitialized in this function [-Werror=maybe-uninitialized]
    return nhlt_endpoint_add_formats(endp, formats, num_formats);
    ^
    
    Change-Id: Idc22c8478ff666af8915d780d7553909c3163690
    Signed-off-by: Martin Roth <martinroth at google.com>
---
 src/soc/intel/skylake/nhlt/dmic.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/soc/intel/skylake/nhlt/dmic.c b/src/soc/intel/skylake/nhlt/dmic.c
index 0aadbb2..6e14891 100644
--- a/src/soc/intel/skylake/nhlt/dmic.c
+++ b/src/soc/intel/skylake/nhlt/dmic.c
@@ -90,6 +90,8 @@ int nhlt_soc_add_dmic_array(struct nhlt *nhlt, int num_channels)
 		num_formats = ARRAY_SIZE(dmic_4ch_cfg);
 		mic_config.array_type = NHLT_MIC_ARRAY_4CH_L_SHAPED;
 		break;
+	default:
+		return -1;
 	}
 
 	if (nhlt_endpoint_append_config(endp, &mic_config, sizeof(mic_config)))



More information about the coreboot-gerrit mailing list