diff mbox

[U-Boot,4/6] dm: pci: Pass only device/function to pci_bus_find_devfn()

Message ID BLU436-SMTP119B46BEFFA865558DF5DA2BF870@phx.gbl
State Accepted
Delegated to: Simon Glass
Headers show

Commit Message

Bin Meng July 18, 2015, 4:20 p.m. UTC
In dm_pci_hose_probe_bus(), pci_bus_find_devfn() is called with a bdf
which includes a bus number, but it really should not as this routine
only expects a device/function encoding.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---

 drivers/pci/pci-uclass.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Simon Glass July 20, 2015, 1:59 a.m. UTC | #1
On 18 July 2015 at 10:20, Bin Meng <bmeng.cn@gmail.com> wrote:
> In dm_pci_hose_probe_bus(), pci_bus_find_devfn() is called with a bdf
> which includes a bus number, but it really should not as this routine
> only expects a device/function encoding.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
>
>  drivers/pci/pci-uclass.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
Simon Glass July 20, 2015, 3:01 p.m. UTC | #2
On 19 July 2015 at 19:59, Simon Glass <sjg@chromium.org> wrote:
> On 18 July 2015 at 10:20, Bin Meng <bmeng.cn@gmail.com> wrote:
>> In dm_pci_hose_probe_bus(), pci_bus_find_devfn() is called with a bdf
>> which includes a bus number, but it really should not as this routine
>> only expects a device/function encoding.
>>
>> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>> ---
>>
>>  drivers/pci/pci-uclass.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> Acked-by: Simon Glass <sjg@chromium.org>
> Tested-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-x86, thanks!
diff mbox

Patch

diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
index e92e4f3..164e3e9 100644
--- a/drivers/pci/pci-uclass.c
+++ b/drivers/pci/pci-uclass.c
@@ -323,7 +323,7 @@  int dm_pci_hose_probe_bus(struct pci_controller *hose, pci_dev_t bdf)
 	parent = hose->bus;
 
 	/* Find the bus within the parent */
-	ret = pci_bus_find_devfn(parent, bdf, &bus);
+	ret = pci_bus_find_devfn(parent, PCI_MASK_BUS(bdf), &bus);
 	if (ret) {
 		debug("%s: Cannot find device %x on bus %s: %d\n", __func__,
 		      bdf, parent->name, ret);