Skip to content

Commit f4b39e8

Browse files
committed
powerpc/pci: Fix PHB numbering when using opal-phbid
The recent change to the PHB numbering logic has a logic error in the handling of "ibm,opal-phbid". When an "ibm,opal-phbid" property is present, &prop is written to and ret is set to zero. The following call to of_alias_get_id() is skipped because ret == 0. But then the if (ret >= 0) is true, and the body of that if statement sets prop = ret which throws away the value that was just read from "ibm,opal-phbid". Fix the logic by only doing the ret >= 0 check in the of_alias_get_id() case. Fixes: 0fe1e96 ("powerpc/pci: Prefer PCI domain assignment via DT 'linux,pci-domain' and alias") Reviewed-by: Pali Rohár <pali@kernel.org> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20220802105723.1055178-1-mpe@ellerman.id.au
1 parent ca829e0 commit f4b39e8

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

arch/powerpc/kernel/pci-common.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,13 @@ static int get_phb_number(struct device_node *dn)
9191
}
9292
if (ret)
9393
ret = of_property_read_u64(dn, "ibm,opal-phbid", &prop);
94-
if (ret)
94+
95+
if (ret) {
9596
ret = of_alias_get_id(dn, "pci");
96-
if (ret >= 0) {
97-
prop = ret;
98-
ret = 0;
97+
if (ret >= 0) {
98+
prop = ret;
99+
ret = 0;
100+
}
99101
}
100102
if (ret) {
101103
u32 prop_32;

0 commit comments

Comments
 (0)