mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-02 15:18:19 +00:00
PCI: Use PCI_SET_ERROR_RESPONSE() for disconnected devices
A config read from a PCI device that doesn't exist or doesn't respond causes a PCI error. There's no real data to return to satisfy the CPU read, so most hardware fabricates ~0 data. Use PCI_SET_ERROR_RESPONSE() to set the error response when we think the device has already been disconnected. This helps unify PCI error response checking and make error checks consistent and easier to find. Link: https://lore.kernel.org/r/29db0a6874716db80757e4e3cdd03562f13eb0cb.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
f4f7eb43c5
commit
9bc9310c8f
1 changed files with 3 additions and 3 deletions
|
@ -529,7 +529,7 @@ EXPORT_SYMBOL(pcie_capability_clear_and_set_dword);
|
|||
int pci_read_config_byte(const struct pci_dev *dev, int where, u8 *val)
|
||||
{
|
||||
if (pci_dev_is_disconnected(dev)) {
|
||||
*val = ~0;
|
||||
PCI_SET_ERROR_RESPONSE(val);
|
||||
return PCIBIOS_DEVICE_NOT_FOUND;
|
||||
}
|
||||
return pci_bus_read_config_byte(dev->bus, dev->devfn, where, val);
|
||||
|
@ -539,7 +539,7 @@ EXPORT_SYMBOL(pci_read_config_byte);
|
|||
int pci_read_config_word(const struct pci_dev *dev, int where, u16 *val)
|
||||
{
|
||||
if (pci_dev_is_disconnected(dev)) {
|
||||
*val = ~0;
|
||||
PCI_SET_ERROR_RESPONSE(val);
|
||||
return PCIBIOS_DEVICE_NOT_FOUND;
|
||||
}
|
||||
return pci_bus_read_config_word(dev->bus, dev->devfn, where, val);
|
||||
|
@ -550,7 +550,7 @@ int pci_read_config_dword(const struct pci_dev *dev, int where,
|
|||
u32 *val)
|
||||
{
|
||||
if (pci_dev_is_disconnected(dev)) {
|
||||
*val = ~0;
|
||||
PCI_SET_ERROR_RESPONSE(val);
|
||||
return PCIBIOS_DEVICE_NOT_FOUND;
|
||||
}
|
||||
return pci_bus_read_config_dword(dev->bus, dev->devfn, where, val);
|
||||
|
|
Loading…
Reference in a new issue