ALSA: au88x0: Fix incorrect error handling for PCI config reads

__snd_vortex_probe() uses pci_read_config_word() that returns PCIBIOS_*
codes (positive values on error). However, the function checks 'err < 0'
which can never be true for PCIBIOS_* codes, causing errors to be silently
ignored.

Check for non-zero return value and convert PCIBIOS_* codes using
pcibios_err_to_errno() into normal errno before returning them.

Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
Reviewed-by: Philipp Stanner <phasta@kernel.org>
Link: https://patch.msgid.link/20251117065559.1138-1-vulab@iscas.ac.cn
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Haotian Zhang
2025-11-17 14:55:59 +08:00
committed by Takashi Iwai
parent 21a9ab5b90
commit d4371c266b

View File

@@ -280,11 +280,11 @@ __snd_vortex_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
// (5) // (5)
err = pci_read_config_word(pci, PCI_DEVICE_ID, &chip->device); err = pci_read_config_word(pci, PCI_DEVICE_ID, &chip->device);
if (err < 0) if (err)
return err; return pcibios_err_to_errno(err);
err = pci_read_config_word(pci, PCI_VENDOR_ID, &chip->vendor); err = pci_read_config_word(pci, PCI_VENDOR_ID, &chip->vendor);
if (err < 0) if (err)
return err; return pcibios_err_to_errno(err);
chip->rev = pci->revision; chip->rev = pci->revision;
#ifdef CHIP_AU8830 #ifdef CHIP_AU8830
if ((chip->rev) != 0xfe && (chip->rev) != 0xfa) { if ((chip->rev) != 0xfe && (chip->rev) != 0xfa) {