ASoC: codecs: hda: Fix RPM usage count underflow

[ Upstream commit ff0045de4ee0288dec683690f66f2f369b7d3466 ]

RPM manipulation in hda_codec_probe_complete()'s error path is
superfluous and leads to RPM usage count underflow if the
build-controls operation fails.

hda_codec_probe_complete() is called in:

1) hda_codec_probe() for all non-HDMI codecs
2) in card->late_probe() for HDMI codecs

Error path for hda_codec_probe() takes care of bus' RPM already.
For 2) if late_probe() fails, ASoC performs card cleanup what
triggers hda_codec_remote() - same treatment is in 1).

Fixes: b5df2a7dca ("ASoC: codecs: Add HD-Audio codec driver")
Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://patch.msgid.link/20250530141025.2942936-2-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Cezary Rojewski
2025-05-30 16:10:17 +02:00
committed by Greg Kroah-Hartman
parent 0fd2ae4017
commit 9836cc310e

View File

@@ -150,7 +150,7 @@ int hda_codec_probe_complete(struct hda_codec *codec)
ret = snd_hda_codec_build_controls(codec); ret = snd_hda_codec_build_controls(codec);
if (ret < 0) { if (ret < 0) {
dev_err(&hdev->dev, "unable to create controls %d\n", ret); dev_err(&hdev->dev, "unable to create controls %d\n", ret);
goto out; return ret;
} }
/* Bus suspended codecs as it does not manage their pm */ /* Bus suspended codecs as it does not manage their pm */
@@ -158,7 +158,7 @@ int hda_codec_probe_complete(struct hda_codec *codec)
/* rpm was forbidden in snd_hda_codec_device_new() */ /* rpm was forbidden in snd_hda_codec_device_new() */
snd_hda_codec_set_power_save(codec, 2000); snd_hda_codec_set_power_save(codec, 2000);
snd_hda_codec_register(codec); snd_hda_codec_register(codec);
out:
/* Complement pm_runtime_get_sync(bus) in probe */ /* Complement pm_runtime_get_sync(bus) in probe */
pm_runtime_mark_last_busy(bus->dev); pm_runtime_mark_last_busy(bus->dev);
pm_runtime_put_autosuspend(bus->dev); pm_runtime_put_autosuspend(bus->dev);