ASoC: soc-pcm: fixup dpcm_be_dai_startup() user count
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tue, 9 Mar 2021 01:08:08 +0000 (10:08 +0900)
committerMark Brown <broonie@kernel.org>
Fri, 12 Mar 2021 14:26:30 +0000 (14:26 +0000)
commit1db19c151819dea7a0dc4d888250d25abaf229ca
tree12489298aff412a454aaa3fc76f7a60195e7116f
parentc393281a3c1cb252735c46efbf8501a3782f9afa
ASoC: soc-pcm: fixup dpcm_be_dai_startup() user count

At dpcm_be_dai_startup_unwind(), it indicates error message at (1)
if this function was called with no users.
But, it doesn't use "continue" here. Thus, users will be a
negative number at (2)

void dpcm_be_dai_startup_unwind(...)
{
...
for_each_dpcm_be(...) {
...
(1) if (be->dpcm[stream].users == 0)
dev_err(...);

(2) if (--be->dpcm[stream].users != 0)
continue;

At dpcm_be_dai_startup(), it indicates error message if
user reached to MAX USERS at (A).
But, it doesn't use "continue" here. Thus, it will be over
MAX USERS at (B).

int dpcm_be_dai_startup(...)
{
...
for_each_dpcm_be(...) {
...
(A) if (be->dpcm[stream].users == DPCM_MAX_BE_USERS)
dev_err(...);

(B) if (be->dpcm[stream].users++ != 0)
continue;

These are just bug. This patch fixup these.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87czw9uoav.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/soc-pcm.c