ASoC: codecs: lpass-macro: add helpers to get codec version
Hello Srinivas Kandagatla,
Commit 378918d59181 ("ASoC: codecs: lpass-macro: add helpers to get codec version") from Jun 13, 2024 (linux-next), leads to the following Smatch static checker warning:
sound/soc/codecs/lpass-va-macro.c:1485 va_macro_set_lpass_codec_version()
error: uninitialized symbol 'version'.
sound/soc/codecs/lpass-va-macro.c
1464 static void va_macro_set_lpass_codec_version(struct va_macro *va)
1465 {
1466 int core_id_0 = 0, core_id_1 = 0, core_id_2 = 0, version;We could just initialize this to zero to make the checker happy? The compiler is generally going to zero it anyway so it's free.
1467
1468 regmap_read(va->regmap, CDC_VA_TOP_CSR_CORE_ID_0, &core_id_0);
1469 regmap_read(va->regmap, CDC_VA_TOP_CSR_CORE_ID_1, &core_id_1);
1470 regmap_read(va->regmap, CDC_VA_TOP_CSR_CORE_ID_2, &core_id_2);
1471
1472 if ((core_id_0 == 0x01) && (core_id_1 == 0x0F))
1473 version = LPASS_CODEC_VERSION_2_0;
1474 if ((core_id_0 == 0x02) && (core_id_1 == 0x0E))
1475 version = LPASS_CODEC_VERSION_2_1;
1476 if ((core_id_0 == 0x02) && (core_id_1 == 0x0F) && (core_id_2 == 0x50 || core_id_2 == 0x51))
1477 version = LPASS_CODEC_VERSION_2_5;
1478 if ((core_id_0 == 0x02) && (core_id_1 == 0x0F) && (core_id_2 == 0x60 || core_id_2 == 0x61))
1479 version = LPASS_CODEC_VERSION_2_6;
1480 if ((core_id_0 == 0x02) && (core_id_1 == 0x0F) && (core_id_2 == 0x70 || core_id_2 == 0x71))
1481 version = LPASS_CODEC_VERSION_2_7;
1482 if ((core_id_0 == 0x02) && (core_id_1 == 0x0F) && (core_id_2 == 0x80 || core_id_2 == 0x81))
1483 version = LPASS_CODEC_VERSION_2_8;
1484
--> 1485 lpass_macro_set_codec_version(version);
1486
1487 dev_dbg(va->dev, "LPASS Codec Version %s\n", lpass_macro_get_codec_version_string(version));
1488 }regards,
dan carpenter