Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Cezary Rojewski <cezary.rojewski@intel.com>
To: broonie@kernel.org
Cc: tiwai@suse.com, perex@perex.cz,
	amadeuszx.slawinski@linux.intel.com, linux-sound@vger.kernel.org,
	Cezary Rojewski <cezary.rojewski@intel.com>
Subject: [PATCH 1/9] ASoC: codecs: hda: Fix RPM usage count underflow
Date: Fri, 30 May 2025 16:10:17 +0200	[thread overview]
Message-ID: <20250530141025.2942936-2-cezary.rojewski@intel.com> (raw)
In-Reply-To: <20250530141025.2942936-1-cezary.rojewski@intel.com>

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: b5df2a7dca1c ("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>
---
 sound/soc/codecs/hda.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/hda.c b/sound/soc/codecs/hda.c
index ddc00927313c..dc7794c9ac44 100644
--- a/sound/soc/codecs/hda.c
+++ b/sound/soc/codecs/hda.c
@@ -152,7 +152,7 @@ int hda_codec_probe_complete(struct hda_codec *codec)
 	ret = snd_hda_codec_build_controls(codec);
 	if (ret < 0) {
 		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 */
@@ -160,7 +160,7 @@ int hda_codec_probe_complete(struct hda_codec *codec)
 	/* rpm was forbidden in snd_hda_codec_device_new() */
 	snd_hda_codec_set_power_save(codec, 2000);
 	snd_hda_codec_register(codec);
-out:
+
 	/* Complement pm_runtime_get_sync(bus) in probe */
 	pm_runtime_mark_last_busy(bus->dev);
 	pm_runtime_put_autosuspend(bus->dev);
-- 
2.25.1


  reply	other threads:[~2025-05-30 13:53 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-30 14:10 [PATCH 0/9] ASoC: Intel: avs: Set of functional fixes Cezary Rojewski
2025-05-30 14:10 ` Cezary Rojewski [this message]
2025-05-30 14:10 ` [PATCH 2/9] ASoC: Intel: avs: Fix deadlock when the failing IPC is SET_D0IX Cezary Rojewski
2025-05-30 14:10 ` [PATCH 3/9] ASoC: Intel: avs: Fix PPLCxFMT calculation Cezary Rojewski
2025-05-30 14:10 ` [PATCH 4/9] ASoC: Intel: avs: Fix possible null-ptr-deref when initing hw Cezary Rojewski
2025-05-30 14:10 ` [PATCH 5/9] ASoC: Intel: avs: Fix paths in MODULE_FIRMWARE hints Cezary Rojewski
2025-05-30 14:10 ` [PATCH 6/9] ASoC: Intel: avs: Verify kcalloc() status when setting constraints Cezary Rojewski
2025-05-30 14:10 ` [PATCH 7/9] ASoC: Intel: avs: Verify content returned by parse_int_array() Cezary Rojewski
2025-05-30 14:10 ` [PATCH 8/9] ASoC: Intel: avs: Simplify verification of parse_int_array() result Cezary Rojewski
2025-05-30 14:10 ` [PATCH 9/9] ASoC: Intel: avs: Include missing string.h Cezary Rojewski
2025-06-02 16:42 ` (subset) [PATCH 0/9] ASoC: Intel: avs: Set of functional fixes Mark Brown
2025-06-03 10:57   ` Cezary Rojewski
2025-06-03 11:01     ` Mark Brown
2025-06-03 11:03       ` Cezary Rojewski
2025-06-03 16:04 ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250530141025.2942936-2-cezary.rojewski@intel.com \
    --to=cezary.rojewski@intel.com \
    --cc=amadeuszx.slawinski@linux.intel.com \
    --cc=broonie@kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox