]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ASoC: simple-card-utils: fix PCM constraint error check
authorRobert Hancock <robert.hancock@calian.com>
Fri, 2 Jun 2023 01:19:35 +0000 (19:19 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Jun 2023 09:17:02 +0000 (11:17 +0200)
commit721b78b745b2015660d2842606fceb60a143e998
tree0cf9208433a1c7253dc561f634929b1b00fa9560
parentd76b9c2424e76a6cc122334ee34420040c17f253
ASoC: simple-card-utils: fix PCM constraint error check

[ Upstream commit 635071f5fee31550e921644b2becc42b3ff1036c ]

The code in asoc_simple_startup was treating any non-zero return from
snd_pcm_hw_constraint_minmax as an error, when this can return 1 in some
normal cases and only negative values indicate an error.

When this happened, it caused asoc_simple_startup to disable the clocks
it just enabled and return 1, which was not treated as an error by the
calling code which only checks for negative return values. Then when the
PCM is eventually shut down, it causes the clock framework to complain
about disabling clocks that were not enabled.

Fix the check for snd_pcm_hw_constraint_minmax return value to only
treat negative values as an error.

Fixes: 5ca2ab459817 ("ASoC: simple-card-utils: Add new system-clock-fixed flag")
Signed-off-by: Robert Hancock <robert.hancock@calian.com>
Link: https://lore.kernel.org/r/20230602011936.231931-1-robert.hancock@calian.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
sound/soc/generic/simple-card-utils.c