diff mbox series

core/pci-dt-slots: Fix devfn lookup

Message ID 20180427045401.24024-1-oohall@gmail.com
State Accepted
Headers show
Series core/pci-dt-slots: Fix devfn lookup | expand

Commit Message

Oliver O'Halloran April 27, 2018, 4:54 a.m. UTC
We only want to use the device part of the bdfn when looking up the
switch down port. The required bit twiddling happens inside
find_devfn() and the masking here is broken since:

	a) Keeps the fn part of the bdfn, and
	b) Masks off part of the device number.

This breaks looking up the slot information in some cases.

Fixes: 6878b806682f ("pci-dt-slot: Big ol' cleanup")
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
---
 core/pci-dt-slot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Stewart Smith April 30, 2018, 7:39 a.m. UTC | #1
Oliver O'Halloran <oohall@gmail.com> writes:
> We only want to use the device part of the bdfn when looking up the
> switch down port. The required bit twiddling happens inside
> find_devfn() and the masking here is broken since:
>
> 	a) Keeps the fn part of the bdfn, and
> 	b) Masks off part of the device number.
>
> This breaks looking up the slot information in some cases.
>
> Fixes: 6878b806682f ("pci-dt-slot: Big ol' cleanup")
> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
> ---
>  core/pci-dt-slot.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Merged as of 3a0c57d0182911345aca784c19cce5095dbb0a09
diff mbox series

Patch

diff --git a/core/pci-dt-slot.c b/core/pci-dt-slot.c
index 4f5a0805e005..448a8f00cec5 100644
--- a/core/pci-dt-slot.c
+++ b/core/pci-dt-slot.c
@@ -152,7 +152,7 @@  static struct dt_node *find_node_for_dev(struct phb *phb,
 			return NULL;
 
 		/* find this down port */
-		return find_devfn(sw_up, pd->bdfn & 0x1f);
+		return find_devfn(sw_up, pd->bdfn);
 
 	default:
 		PCIDBG(phb, pd->bdfn,