Skip to content

Commit d4371c2

Browse files
ISCAS-Vulabtiwai
authored andcommitted
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>
1 parent 21a9ab5 commit d4371c2

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

sound/pci/au88x0/au88x0.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -280,11 +280,11 @@ __snd_vortex_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
280280

281281
// (5)
282282
err = pci_read_config_word(pci, PCI_DEVICE_ID, &chip->device);
283-
if (err < 0)
284-
return err;
283+
if (err)
284+
return pcibios_err_to_errno(err);
285285
err = pci_read_config_word(pci, PCI_VENDOR_ID, &chip->vendor);
286-
if (err < 0)
287-
return err;
286+
if (err)
287+
return pcibios_err_to_errno(err);
288288
chip->rev = pci->revision;
289289
#ifdef CHIP_AU8830
290290
if ((chip->rev) != 0xfe && (chip->rev) != 0xfa) {

0 commit comments

Comments
 (0)