ASoC: soc-pcm.c: use temporary variable at soc_get_playback_capture()
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tue, 30 May 2023 00:50:01 +0000 (00:50 +0000)
committerMark Brown <broonie@kernel.org>
Wed, 31 May 2023 11:25:05 +0000 (12:25 +0100)
commitc3e9b6d6ef5a0a3e841c3aa29e7afc48a0b73806
tree880e8f7a36f14e36a61d41c8f4a3f0ac5f9adda5
parenta1c0221fa5baeae6c9dc30294c2c6d01f1f4379b
ASoC: soc-pcm.c: use temporary variable at soc_get_playback_capture()

soc_get_playback_capture() (A) returns number of substreams for
playback/capture (B).

(A) static int soc_get_playback_capture(...,
(B) int *playback, int *capture)
{
...
for_each_xxx(...) {
if (xxx)
return -EINVAL;
=> *playback = 1;
...
=> *capture = 1;
...
}
...
}

But, it is directly updating playback/capture which is the result of this
function even though it might be error. It should be updated in case of
succeed only. This patch updates it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/87ttvuzlqe.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/soc-pcm.c