PCI: Fix return value from pci_user_{read,write}_config_*()

The PCI user-space config accessors pci_user_{read,write}_config_*() return
negative error numbers, which were introduced by commit 34e3207205
("PCI: handle positive error codes").  That patch converted all positive
error numbers from platform-specific PCI config accessors to -EINVAL, which
means the callers don't know anything about the specific cause of the
failure.

The patch fixes the issue by converting the positive PCIBIOS_* error values
to generic negative error numbers with pcibios_err_to_errno().

[bhelgaas: changelog]
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Greg Thelen <gthelen@google.com>
This commit is contained in:
Gavin Shan 2014-05-21 15:23:30 +10:00 committed by Bjorn Helgaas
parent a43ae58c84
commit d97ffe2368
2 changed files with 6 additions and 10 deletions

View file

@ -518,7 +518,7 @@ static inline int pcibios_err_to_errno(int err)
case PCIBIOS_FUNC_NOT_SUPPORTED:
return -ENOENT;
case PCIBIOS_BAD_VENDOR_ID:
return -EINVAL;
return -ENOTTY;
case PCIBIOS_DEVICE_NOT_FOUND:
return -ENODEV;
case PCIBIOS_BAD_REGISTER_NUMBER:
@ -529,7 +529,7 @@ static inline int pcibios_err_to_errno(int err)
return -ENOSPC;
}
return -ENOTTY;
return -ERANGE;
}
/* Low-level architecture-dependent routines */