Re: [PATCH] ALSA: hda: Check snd_hda_power_pm construct error before executing verb

From: Takashi Iwai

Date: Mon Jul 13 2026 - 06:15:58 EST


On Mon, 13 Jul 2026 04:04:27 +0200,
songxiebing wrote:
>
> From: Bob Song <songxiebing@xxxxxxxxxx>
>
> When userspace writes 1 to /sys/bus/pci/devices/XX/remove to remove HDA PCI device,
> the codec device enters runtime suspended state early. The snd_hda_power_pm RAII
> constructor fails to wake up codec, but the original code ignores pm.err and continues
> to execute hda verb commands. After pci driver remove callback completes, devres
> automatically iounmap the BAR virtual address bus->remap_addr, resulting in access
> to invalid unmapped MMIO address and triggering page fault BUG.
>
> Add error check for snd_hda_power_pm constructor result:
> 1. Detect pm construction failure when HDA core device is suspended;
> 2. Print warning log with command and error code for debug;
> 3. Return early to skip subsequent hardware register access, avoid page fault crash.
>
> Signed-off-by: Bob Song <songxiebing@xxxxxxxxxx>

Applied to for-next branch. Thanks.


Takashi