mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 14:11:52 +00:00
PCI: thunder: Drop error data fabrication when config read fails
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/22f471b638276422926c49f3d42ac41bc7b28b3d.1637243717.git.naveennaidu479@gmail.com Signed-off-by: Naveen Naidu <naveennaidu479@gmail.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
This commit is contained in:
parent
316df7062a
commit
658f7ecd67
@ -41,10 +41,9 @@ static int handle_ea_bar(u32 e0, int bar, struct pci_bus *bus,
|
||||
}
|
||||
if (where_a == 0x4) {
|
||||
addr = bus->ops->map_bus(bus, devfn, bar); /* BAR 0 */
|
||||
if (!addr) {
|
||||
*val = ~0;
|
||||
if (!addr)
|
||||
return PCIBIOS_DEVICE_NOT_FOUND;
|
||||
}
|
||||
|
||||
v = readl(addr);
|
||||
v &= ~0xf;
|
||||
v |= 2; /* EA entry-1. Base-L */
|
||||
@ -56,10 +55,9 @@ static int handle_ea_bar(u32 e0, int bar, struct pci_bus *bus,
|
||||
u32 barl_rb;
|
||||
|
||||
addr = bus->ops->map_bus(bus, devfn, bar); /* BAR 0 */
|
||||
if (!addr) {
|
||||
*val = ~0;
|
||||
if (!addr)
|
||||
return PCIBIOS_DEVICE_NOT_FOUND;
|
||||
}
|
||||
|
||||
barl_orig = readl(addr + 0);
|
||||
writel(0xffffffff, addr + 0);
|
||||
barl_rb = readl(addr + 0);
|
||||
@ -72,10 +70,9 @@ static int handle_ea_bar(u32 e0, int bar, struct pci_bus *bus,
|
||||
}
|
||||
if (where_a == 0xc) {
|
||||
addr = bus->ops->map_bus(bus, devfn, bar + 4); /* BAR 1 */
|
||||
if (!addr) {
|
||||
*val = ~0;
|
||||
if (!addr)
|
||||
return PCIBIOS_DEVICE_NOT_FOUND;
|
||||
}
|
||||
|
||||
v = readl(addr); /* EA entry-3. Base-H */
|
||||
set_val(v, where, size, val);
|
||||
return PCIBIOS_SUCCESSFUL;
|
||||
@ -104,10 +101,8 @@ static int thunder_ecam_p2_config_read(struct pci_bus *bus, unsigned int devfn,
|
||||
}
|
||||
|
||||
addr = bus->ops->map_bus(bus, devfn, where_a);
|
||||
if (!addr) {
|
||||
*val = ~0;
|
||||
if (!addr)
|
||||
return PCIBIOS_DEVICE_NOT_FOUND;
|
||||
}
|
||||
|
||||
v = readl(addr);
|
||||
|
||||
@ -135,10 +130,8 @@ static int thunder_ecam_config_read(struct pci_bus *bus, unsigned int devfn,
|
||||
int where_a = where & ~3;
|
||||
|
||||
addr = bus->ops->map_bus(bus, devfn, 0xc);
|
||||
if (!addr) {
|
||||
*val = ~0;
|
||||
if (!addr)
|
||||
return PCIBIOS_DEVICE_NOT_FOUND;
|
||||
}
|
||||
|
||||
v = readl(addr);
|
||||
|
||||
@ -146,10 +139,8 @@ static int thunder_ecam_config_read(struct pci_bus *bus, unsigned int devfn,
|
||||
cfg_type = (v >> 16) & 0x7f;
|
||||
|
||||
addr = bus->ops->map_bus(bus, devfn, 8);
|
||||
if (!addr) {
|
||||
*val = ~0;
|
||||
if (!addr)
|
||||
return PCIBIOS_DEVICE_NOT_FOUND;
|
||||
}
|
||||
|
||||
class_rev = readl(addr);
|
||||
if (class_rev == 0xffffffff)
|
||||
@ -176,10 +167,8 @@ static int thunder_ecam_config_read(struct pci_bus *bus, unsigned int devfn,
|
||||
}
|
||||
|
||||
addr = bus->ops->map_bus(bus, devfn, 0);
|
||||
if (!addr) {
|
||||
*val = ~0;
|
||||
if (!addr)
|
||||
return PCIBIOS_DEVICE_NOT_FOUND;
|
||||
}
|
||||
|
||||
vendor_device = readl(addr);
|
||||
if (vendor_device == 0xffffffff)
|
||||
@ -196,10 +185,9 @@ static int thunder_ecam_config_read(struct pci_bus *bus, unsigned int devfn,
|
||||
bool is_tns = (vendor_device == 0xa01f177d);
|
||||
|
||||
addr = bus->ops->map_bus(bus, devfn, 0x70);
|
||||
if (!addr) {
|
||||
*val = ~0;
|
||||
if (!addr)
|
||||
return PCIBIOS_DEVICE_NOT_FOUND;
|
||||
}
|
||||
|
||||
/* E_CAP */
|
||||
v = readl(addr);
|
||||
has_msix = (v & 0xff00) != 0;
|
||||
@ -211,10 +199,9 @@ static int thunder_ecam_config_read(struct pci_bus *bus, unsigned int devfn,
|
||||
}
|
||||
if (where_a == 0xb0) {
|
||||
addr = bus->ops->map_bus(bus, devfn, where_a);
|
||||
if (!addr) {
|
||||
*val = ~0;
|
||||
if (!addr)
|
||||
return PCIBIOS_DEVICE_NOT_FOUND;
|
||||
}
|
||||
|
||||
v = readl(addr);
|
||||
if (v & 0xff00)
|
||||
pr_err("Bad MSIX cap header: %08x\n", v);
|
||||
@ -268,10 +255,9 @@ static int thunder_ecam_config_read(struct pci_bus *bus, unsigned int devfn,
|
||||
|
||||
if (where_a == 0x70) {
|
||||
addr = bus->ops->map_bus(bus, devfn, where_a);
|
||||
if (!addr) {
|
||||
*val = ~0;
|
||||
if (!addr)
|
||||
return PCIBIOS_DEVICE_NOT_FOUND;
|
||||
}
|
||||
|
||||
v = readl(addr);
|
||||
if (v & 0xff00)
|
||||
pr_err("Bad PCIe cap header: %08x\n", v);
|
||||
|
@ -41,10 +41,8 @@ static int thunder_pem_bridge_read(struct pci_bus *bus, unsigned int devfn,
|
||||
struct pci_config_window *cfg = bus->sysdata;
|
||||
struct thunder_pem_pci *pem_pci = (struct thunder_pem_pci *)cfg->priv;
|
||||
|
||||
if (devfn != 0 || where >= 2048) {
|
||||
*val = ~0;
|
||||
if (devfn != 0 || where >= 2048)
|
||||
return PCIBIOS_DEVICE_NOT_FOUND;
|
||||
}
|
||||
|
||||
/*
|
||||
* 32-bit accesses only. Write the address to the low order
|
||||
|
Loading…
Reference in New Issue
Block a user