Skip to content

Commit 88303fb

Browse files
niklas88hcahca
authored andcommitted
s390/pci: Use PCIBIOS return values in pci_read()/pci_write()
While pci_read() and pci_write() have returned errno values since their inception with commit cd24834 ("s390/pci: base support") other config accessors in particular pci_generic_config_read() as well as pci_generic_config_write() return specific error values which are then converted to errno by pcibios_err_to_errno(). Since latter does handle the case where the error value already looks like an errno the previous behavior is unlikely to cause actual issues. Still, for consistency and in case any caller explicitly checks error values align pci_read() and pci_write() with the generic accessors. Reviewed-by: Benjamin Block <bblock@linux.ibm.com> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com> Reviewed-by: Farhan Ali <alifm@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
1 parent 84d875e commit 88303fb

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

arch/s390/pci/pci.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,15 +406,19 @@ static int pci_read(struct pci_bus *bus, unsigned int devfn, int where,
406406
{
407407
struct zpci_dev *zdev = zdev_from_bus(bus, devfn);
408408

409-
return (zdev) ? zpci_cfg_load(zdev, where, val, size) : -ENODEV;
409+
if (!zdev || zpci_cfg_load(zdev, where, val, size))
410+
return PCIBIOS_DEVICE_NOT_FOUND;
411+
return PCIBIOS_SUCCESSFUL;
410412
}
411413

412414
static int pci_write(struct pci_bus *bus, unsigned int devfn, int where,
413415
int size, u32 val)
414416
{
415417
struct zpci_dev *zdev = zdev_from_bus(bus, devfn);
416418

417-
return (zdev) ? zpci_cfg_store(zdev, where, val, size) : -ENODEV;
419+
if (!zdev || zpci_cfg_store(zdev, where, val, size))
420+
return PCIBIOS_DEVICE_NOT_FOUND;
421+
return PCIBIOS_SUCCESSFUL;
418422
}
419423

420424
static struct pci_ops pci_root_ops = {

0 commit comments

Comments
 (0)