* [PATCH] ALSA: hda: cix-ipbloq: Fix runtime PM handling on probe failure
@ 2026-12-02 9:40 Sreeraj S Kurup
2026-12-02 10:23 ` [PATCH v2] " Sreeraj S Kurup
2026-12-02 10:35 ` [PATCH v3] " Sreeraj S Kurup
0 siblings, 2 replies; 4+ messages in thread
From: Sreeraj S Kurup @ 2026-12-02 9:40 UTC (permalink / raw)
To: perex, tiwai, gary.yang, fugang.duan, cix-kernel-upstream
Cc: linux-sound, linux-arm-kernel, linux-kernel, Sreeraj S Kurup
The driver enables runtime PM before calling
pm_runtime_resume_and_get().
If cix_ipbloq_hda_init() or cix_ipbloq_hda_probe_codec()
fails, the runtime PM usage reference is not released.
Release the reference on these failure paths and disable
runtime PM before freeing the ALSA device and card.
Also disable runtime PM if pm_runtime_resume_and_get()
fails, as runtime PM was already enabled.
Signed-off-by: Sreeraj S Kurup <sreekuttan2156239@gmail.com>
---
sound/hda/controllers/cix-ipbloq.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/sound/hda/controllers/cix-ipbloq.c b/sound/hda/controllers/cix-ipbloq.c
index f73d6216bce3..d1cb9c01aa16 100644
--- a/sound/hda/controllers/cix-ipbloq.c
+++ b/sound/hda/controllers/cix-ipbloq.c
@@ -284,21 +284,25 @@ static int cix_ipbloq_hda_probe(struct platform_device *pdev)
err = pm_runtime_resume_and_get(hda->dev);
if (err < 0) {
dev_err(hda->dev, "runtime resume and get failed, err = %d\n", err);
- goto out_free_device;
+ goto out_pm_disable;
}
err = cix_ipbloq_hda_init(hda, chip, pdev);
if (err < 0)
- goto out_free_device;
+ goto out_pm_put;
err = cix_ipbloq_hda_probe_codec(hda);
if (err < 0)
- goto out_free_device;
+ goto out_pm_put;
pm_runtime_put(hda->dev);
return 0;
+out_pm_put:
+ pm_runtime_put_sync(hda->dev);
+out_pm_disable:
+ pm_runtime_disable(hda->dev);
out_free_device:
snd_device_free(card, chip);
out_free_card:
--
2.55.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] ALSA: hda: cix-ipbloq: Fix runtime PM handling on probe failure
2026-12-02 9:40 [PATCH] ALSA: hda: cix-ipbloq: Fix runtime PM handling on probe failure Sreeraj S Kurup
@ 2026-12-02 10:23 ` Sreeraj S Kurup
2026-12-02 10:35 ` [PATCH v3] " Sreeraj S Kurup
1 sibling, 0 replies; 4+ messages in thread
From: Sreeraj S Kurup @ 2026-12-02 10:23 UTC (permalink / raw)
To: sreekuttan2156239, cix-kernel-upstream, fugang.duan, gary.yang,
perex, tiwai
Cc: linux-arm-kernel, linux-kernel, linux-sound
The driver enables runtime PM before calling
pm_runtime_resume_and_get().
If cix_ipbloq_hda_init() or cix_ipbloq_hda_probe_codec()
fails, the runtime PM usage reference must be released.
However, calling pm_runtime_put_sync() before freeing the
ALSA device can trigger runtime suspend and disable the
controller clocks. The ALSA device cleanup may then access
controller registers while the clocks are disabled.
Disable runtime PM first and keep the controller clocks
enabled while freeing the ALSA device and card. Then balance
the runtime PM reference without triggering runtime suspend
and disable the clocks explicitly.
Also disable runtime PM if pm_runtime_resume_and_get()
fails.
Fixes: d91e9bd10125 ("ALSA: hda: add CIX IPBLOQ HDA controller support")
Signed-off-by: Sreeraj S Kurup <sreekuttan2156239@gmail.com>
---
sound/hda/controllers/cix-ipbloq.c | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/sound/hda/controllers/cix-ipbloq.c b/sound/hda/controllers/cix-ipbloq.c
index f73d6216bce3..10ae8729c312 100644
--- a/sound/hda/controllers/cix-ipbloq.c
+++ b/sound/hda/controllers/cix-ipbloq.c
@@ -237,6 +237,7 @@ static int cix_ipbloq_hda_probe(struct platform_device *pdev)
struct cix_ipbloq_hda *hda;
struct snd_card *card;
struct azx *chip;
+ bool pm_ref = false;
int err;
hda = devm_kzalloc_obj(&pdev->dev, *hda);
@@ -284,21 +285,37 @@ static int cix_ipbloq_hda_probe(struct platform_device *pdev)
err = pm_runtime_resume_and_get(hda->dev);
if (err < 0) {
dev_err(hda->dev, "runtime resume and get failed, err = %d\n", err);
- goto out_free_device;
+ goto out_pm_disable;
}
+ pm_ref = true;
+
err = cix_ipbloq_hda_init(hda, chip, pdev);
if (err < 0)
- goto out_free_device;
+ goto out_pm_cleanup;
err = cix_ipbloq_hda_probe_codec(hda);
if (err < 0)
- goto out_free_device;
+ goto out_pm_cleanup;
pm_runtime_put(hda->dev);
return 0;
+out_pm_cleanup:
+ pm_runtime_disable(hda->dev);
+ snd_device_free(card, chip);
+ snd_card_free(card);
+ if (pm_ref) {
+ pm_runtime_put_noidle(hda->dev);
+ clk_bulk_disable_unprepare(hda->nclocks, hda->clocks);
+ }
+ return err;
+
+out_pm_disable:
+ pm_runtime_disable(hda->dev);
+ goto out_free_device;
+
out_free_device:
snd_device_free(card, chip);
out_free_card:
--
2.55.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v3] ALSA: hda: cix-ipbloq: Fix runtime PM handling on probe failure
2026-12-02 9:40 [PATCH] ALSA: hda: cix-ipbloq: Fix runtime PM handling on probe failure Sreeraj S Kurup
2026-12-02 10:23 ` [PATCH v2] " Sreeraj S Kurup
@ 2026-12-02 10:35 ` Sreeraj S Kurup
2026-12-02 11:58 ` Sreeraj S Kurup
1 sibling, 1 reply; 4+ messages in thread
From: Sreeraj S Kurup @ 2026-12-02 10:35 UTC (permalink / raw)
To: sreekuttan2156239, cix-kernel-upstream, fugang.duan, gary.yang,
perex, tiwai
Cc: linux-arm-kernel, linux-kernel, linux-sound
The driver enables runtime PM before calling
pm_runtime_resume_and_get().
If cix_ipbloq_hda_init() or cix_ipbloq_hda_probe_codec()
fails, the runtime PM usage reference must be released.
However, calling pm_runtime_put_sync() before freeing the
ALSA device can trigger runtime suspend and disable the
controller clocks. The ALSA device cleanup may then access
controller registers while the clocks are disabled.
Disable runtime PM first and keep the controller clocks
enabled while freeing the ALSA device and card. Then balance
the runtime PM reference without triggering runtime suspend
and disable the clocks explicitly.
Also disable runtime PM if pm_runtime_resume_and_get()
fails.
Fixes: d91e9bd10125 ("ALSA: hda: add CIX IPBLOQ HDA controller support")
Signed-off-by: Sreeraj S Kurup <sreekuttan2156239@gmail.com>
---
v3:
- Add the missing changelog for v2.
v2:
- Fix runtime PM cleanup ordering to avoid unclocked MMIO
accesses during ALSA device cleanup.
- Balance the runtime PM reference using pm_runtime_put_noidle()
after freeing the ALSA device and card.
- Keep controller clocks enabled during ALSA cleanup and
disable them afterward.
- Handle runtime PM cleanup when pm_runtime_resume_and_get()
fails.
sound/hda/controllers/cix-ipbloq.c | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/sound/hda/controllers/cix-ipbloq.c b/sound/hda/controllers/cix-ipbloq.c
index f73d6216bce3..10ae8729c312 100644
--- a/sound/hda/controllers/cix-ipbloq.c
+++ b/sound/hda/controllers/cix-ipbloq.c
@@ -237,6 +237,7 @@ static int cix_ipbloq_hda_probe(struct platform_device *pdev)
struct cix_ipbloq_hda *hda;
struct snd_card *card;
struct azx *chip;
+ bool pm_ref = false;
int err;
hda = devm_kzalloc_obj(&pdev->dev, *hda);
@@ -284,21 +285,37 @@ static int cix_ipbloq_hda_probe(struct platform_device *pdev)
err = pm_runtime_resume_and_get(hda->dev);
if (err < 0) {
dev_err(hda->dev, "runtime resume and get failed, err = %d\n", err);
- goto out_free_device;
+ goto out_pm_disable;
}
+ pm_ref = true;
+
err = cix_ipbloq_hda_init(hda, chip, pdev);
if (err < 0)
- goto out_free_device;
+ goto out_pm_cleanup;
err = cix_ipbloq_hda_probe_codec(hda);
if (err < 0)
- goto out_free_device;
+ goto out_pm_cleanup;
pm_runtime_put(hda->dev);
return 0;
+out_pm_cleanup:
+ pm_runtime_disable(hda->dev);
+ snd_device_free(card, chip);
+ snd_card_free(card);
+ if (pm_ref) {
+ pm_runtime_put_noidle(hda->dev);
+ clk_bulk_disable_unprepare(hda->nclocks, hda->clocks);
+ }
+ return err;
+
+out_pm_disable:
+ pm_runtime_disable(hda->dev);
+ goto out_free_device;
+
out_free_device:
snd_device_free(card, chip);
out_free_card:
--
2.55.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v3] ALSA: hda: cix-ipbloq: Fix runtime PM handling on probe failure
2026-12-02 10:35 ` [PATCH v3] " Sreeraj S Kurup
@ 2026-12-02 11:58 ` Sreeraj S Kurup
0 siblings, 0 replies; 4+ messages in thread
From: Sreeraj S Kurup @ 2026-12-02 11:58 UTC (permalink / raw)
To: sreekuttan2156239, cix-kernel-upstream, fugang.duan, gary.yang,
perex, tiwai, sashiko-bot
Cc: linux-arm-kernel, linux-kernel, linux-sound
Thanks, Sashiko, for the detailed reviews and feedback.
I also appreciate everyone following this patch discussion.
Honestly, I've decided to raise the white flag on this particular
patch for now. The runtime PM and device cleanup interactions
turned out to be more complicated than I expected, and I don't want
to risk introducing further issues.
Sorry for the extra review traffic, and thanks again for your patience
and guidance. I've learned a lot from this review process!
Best regards,
Sreeraj
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-12-02 11:59 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-02 9:40 [PATCH] ALSA: hda: cix-ipbloq: Fix runtime PM handling on probe failure Sreeraj S Kurup
2026-12-02 10:23 ` [PATCH v2] " Sreeraj S Kurup
2026-12-02 10:35 ` [PATCH v3] " Sreeraj S Kurup
2026-12-02 11:58 ` Sreeraj S Kurup
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®