Linux Sound subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: phucduc.bui@gmail.com
Cc: linux-sound@vger.kernel.org
Subject: Re: [PATCH 1/5] ASoC: amd: ps: Use devm_pm_runtime_enable()
Date: Thu, 03 Dec 2026 10:00:22 +0000	[thread overview]
Message-ID: <sashiko-outbox-247519@kernel.org> (raw)
In-Reply-To: <20261203094558.26423-2-phucduc.bui@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] ASoC: amd: ps: runtime PM suspended before component
  unregistration
--

commit afe126b816589bbc879239646442299aee4ce385
Author: bui duc phuc <phucduc.bui@gmail.com>

ASoC: amd: ps: Use devm_pm_runtime_enable()

This commit replaces pm_runtime_enable() and the remove callbacks in the AMD
PS PDM and SoundWire DMA drivers with devm_pm_runtime_enable().

> diff --git a/sound/soc/amd/ps/ps-pdm-dma.c b/sound/soc/amd/ps/ps-pdm-dma.c
> index 359ca10b9ba49..7a894e8688ae1 100644
> --- a/sound/soc/amd/ps/ps-pdm-dma.c
> +++ b/sound/soc/amd/ps/ps-pdm-dma.c
> @@ -400,13 +400,8 @@ static int acp63_pdm_audio_probe(struct platform_device *pdev)
>  	pm_runtime_use_autosuspend(&pdev->dev);
>  	pm_runtime_mark_last_busy(&pdev->dev);
>  	pm_runtime_set_active(&pdev->dev);
> -	pm_runtime_enable(&pdev->dev);
> -	return 0;
> -}
>  
> -static void acp63_pdm_audio_remove(struct platform_device *pdev)
> -{
> -	pm_runtime_disable(&pdev->dev);
> +	return devm_pm_runtime_enable(&pdev->dev);
>  }

[Severity: Medium]
Can calling devm_pm_runtime_enable() after devm_snd_soc_register_component()
suspend the device while its PCM streams can still be opened?

Because devres runs in LIFO order, pm_runtime_disable_action() runs before
devm_component_release() unregisters the component and disconnects the card.
It calls pm_runtime_dont_use_autosuspend() while runtime PM is still enabled,
synchronously suspending the device and releasing the parent PCI device.

CPU0                              CPU1
__device_release_driver()
  devres_release_all()
    pm_runtime_disable_action()
      rpm_suspend()
      pm_runtime_disable()
                                  __soc_pcm_open()
                                    snd_soc_pcm_component_pm_runtime_get()
                                      pm_runtime_get_sync() -> -EACCES
                                    acp63_pdm_dma_open()
                                      <-- MMIO while suspended
    devm_component_release()
      snd_card_disconnect_sync()

snd_soc_pcm_component_pm_runtime_get() ignores -EACCES from
pm_runtime_get_sync(), so a concurrent open reaches acp63_pdm_dma_open() and
accesses ACP registers without resuming the device or its parent PCI device.
acp63_sdw_platform_probe() in sound/soc/amd/ps/ps-sdw-dma.c has the same bug.

Moving the runtime PM setup and devm_pm_runtime_enable() before
devm_snd_soc_register_component() in both probe functions keeps runtime PM
enabled until after the component is unregistered.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261203094558.26423-1-phucduc.bui@gmail.com?part=1

  reply	other threads:[~2026-12-03 10:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03  9:45 [PATCH 0/5] ASoC: amd: Use devm_pm_runtime_enable() phucduc.bui
2026-12-03  9:45 ` [PATCH 1/5] ASoC: amd: ps: " phucduc.bui
2026-12-03 10:00   ` sashiko-bot [this message]
2026-12-03  9:45 ` [PATCH 2/5] ASoC: amd: raven: " phucduc.bui
2026-12-03 10:04   ` sashiko-bot
2026-12-03  9:45 ` [PATCH 3/5] ASoC: amd: renoir: " phucduc.bui
2026-12-03  9:45 ` [PATCH 4/5] ASoC: amd: vangogh: " phucduc.bui
2026-12-03 10:08   ` sashiko-bot
2026-12-03  9:45 ` [PATCH 5/5] ASoC: amd: yc: " phucduc.bui

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=sashiko-outbox-247519@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=phucduc.bui@gmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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