Home
last modified time | relevance | path

Searched hist:"46 ae0b3f554a323322a770c0edee50aa8019a655" (Results 1 – 1 of 1) sorted by relevance

/linux/sound/soc/codecs/
H A Dnau8821.cdiff 46ae0b3f554a323322a770c0edee50aa8019a655 Mon Oct 25 20:59:29 CEST 2021 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> ASoC: nau8821: clarify out-of-bounds check

cppcheck reports a false positive

sound/soc/codecs/nau8821.c:390:17: error: Array 'dmic_speed_sel[4]'
accessed at index 4, which is out of bounds. [arrayIndexOutOfBounds]

dmic_speed_sel[i].param, dmic_speed_sel[i].val);
^
sound/soc/codecs/nau8821.c:378:2: note: After for loop, i has value 4
for (i = 0 ; i < 4 ; i++)
^
sound/soc/codecs/nau8821.c:390:17: note: Array index out of bounds
dmic_speed_sel[i].param, dmic_speed_sel[i].val);
^

While the code is not incorrect, we can deal with the out-of-bounds
check in a clearer way that makes static analysis happy.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211025185933.144327-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>