diff mbox

[U-Boot,3/3] pcie_layerscape: Adjust the return value when ls_pcie_addr_valid() fails

Message ID 1452113598-32409-3-git-send-email-festevam@gmail.com
State Rejected
Headers show

Commit Message

Fabio Estevam Jan. 6, 2016, 8:53 p.m. UTC
From: Fabio Estevam <fabio.estevam@nxp.com>

Since commit ff3e077bd2 ("dm: pci: Add a uclass for PCI") the following
error message is seen:

=> pci 0
Scanning PCI devices on bus 0
BusDevFun  VendorId   DeviceId   Device Class       Sub-Class

Comments

Marek Vasut Jan. 6, 2016, 8:58 p.m. UTC | #1
On Wednesday, January 06, 2016 at 09:53:18 PM, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@nxp.com>
> 
> Since commit ff3e077bd2 ("dm: pci: Add a uclass for PCI") the following
> error message is seen:
> 
> => pci 0
> Scanning PCI devices on bus 0
> BusDevFun  VendorId   DeviceId   Device Class       Sub-Class
> _____________________________________________________________
> 00.01.00   0x16c3     0xabcd     Bridge device           0x04
> Cannot read bus configuration: -1
> 
> We can avoid this error by using the same approach as done in the
> linux kernel PCI designware driver: (drivers/pci/host/pcie-designware.c)
> 
> static int dw_pcie_rd_conf(struct pci_bus *bus, u32 devfn, int where,
> 			int size, u32 *val)
> {
> 	struct pcie_port *pp = bus->sysdata;
> 	int ret;
> 
> 	if (dw_pcie_valid_config(pp, bus, PCI_SLOT(devfn)) == 0) {
> 		*val = 0xffffffff;
> 		return PCIBIOS_DEVICE_NOT_FOUND;
> 	}
> 
> ,where PCIBIOS_DEVICE_NOT_FOUND is returned when an invalid address
> is given.
> 
> Reported-by: Bin Meng <bmeng.cn@gmail.com>
> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>

Good stuff, thanks!

Acked-by: Marek Vasut <marex@denx.de>

I added Stefano on CC, so I added him. I'd like to see all three in mainline for 
this MW.

Best regards,
Marek Vasut
diff mbox

Patch

diff --git a/drivers/pci/pcie_layerscape.c b/drivers/pci/pcie_layerscape.c
index 58e88ae..af0fd71 100644
--- a/drivers/pci/pcie_layerscape.c
+++ b/drivers/pci/pcie_layerscape.c
@@ -314,7 +314,7 @@  static int ls_pcie_read_config(struct pci_controller *hose, pci_dev_t d,
 
 	if (ls_pcie_addr_valid(hose, d)) {
 		*val = 0xffffffff;
-		return -EINVAL;
+		return PCIBIOS_DEVICE_NOT_FOUND;
 	}
 
 	if (PCI_BUS(d) == hose->first_busno) {