ASoC: Intel: Skylake: Uninitialized variable in probe_codec()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 20 Apr 2017 10:17:02 +0000 (13:17 +0300)
committerMark Brown <broonie@kernel.org>
Fri, 21 Apr 2017 16:57:38 +0000 (17:57 +0100)
My static checker complains that if snd_hdac_bus_get_response() returns
-EIO then "res" is uninitialized.  Fix this by initializing it to -1 so
that the error is handled correctly.

Fixes: d8c2dab8381d ("ASoC: Intel: Add Skylake HDA audio driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/intel/skylake/skl.c

index 0c57d4eaae3ae3bf488860f6133acdf9e7e30271..6df3b317a4768e008b539f0a619308e9545a3992 100644 (file)
@@ -512,7 +512,7 @@ static int probe_codec(struct hdac_ext_bus *ebus, int addr)
        struct hdac_bus *bus = ebus_to_hbus(ebus);
        unsigned int cmd = (addr << 28) | (AC_NODE_ROOT << 20) |
                (AC_VERB_PARAMETERS << 8) | AC_PAR_VENDOR_ID;
-       unsigned int res;
+       unsigned int res = -1;
 
        mutex_lock(&bus->cmd_mutex);
        snd_hdac_bus_send_cmd(bus, cmd);