PCI: Drop error data fabrication when config read fails
authorNaveen Naidu <naveennaidu479@gmail.com>
Thu, 18 Nov 2021 14:03:14 +0000 (19:33 +0530)
committerBjorn Helgaas <bhelgaas@google.com>
Thu, 18 Nov 2021 19:38:20 +0000 (13:38 -0600)
If config pci_ops.read() methods return failure, the PCI_OP_READ() and
PCI_USER_READ_CONFIG() wrappers use PCI_SET_ERROR_RESPONSE() to set the
data value, so there's no need to set it in the pci_ops.read() methods
themselves.

Drop the unnecessary data value fabrication when pci_ops.read() fails.

Link: https://lore.kernel.org/r/1b2edb060cf19b45f70645b331e6c08c9ba798c0.1637243717.git.naveennaidu479@gmail.com
Signed-off-by: Naveen Naidu <naveennaidu479@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Rob Herring <robh@kernel.org>
drivers/pci/access.c

index e1add90494ec944280e2c57456a845de9a5c480d..a92637627845e958776a528f8527e2cd59b0dc3a 100644 (file)
@@ -83,10 +83,8 @@ int pci_generic_config_read(struct pci_bus *bus, unsigned int devfn,
        void __iomem *addr;
 
        addr = bus->ops->map_bus(bus, devfn, where);
-       if (!addr) {
-               *val = ~0;
+       if (!addr)
                return PCIBIOS_DEVICE_NOT_FOUND;
-       }
 
        if (size == 1)
                *val = readb(addr);
@@ -125,10 +123,8 @@ int pci_generic_config_read32(struct pci_bus *bus, unsigned int devfn,
        void __iomem *addr;
 
        addr = bus->ops->map_bus(bus, devfn, where & ~0x3);
-       if (!addr) {
-               *val = ~0;
+       if (!addr)
                return PCIBIOS_DEVICE_NOT_FOUND;
-       }
 
        *val = readl(addr);