PCI: fix search for suitable memory region
PATCH 1/1 PCI: fix search for suitable memory region
Binary ANDing a value with 0 and comparing it against 0 always yields true, I guess that's not intended here.
Use the proper mask value for the memory region type bit.
--- drivers/pci/pci_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/pci_common.c +1 -1
@@ -231,7 +231,7 @@ phys_addr_t pci_hose_bus_to_phys(struct pci_controller *hose,* if PCI_REGION_MEM is set we do a two pass search with preference * on matches that don't have PCI_REGION_SYS_MEMORY set */ -if ((flags &PCI_REGION_MEM ) ==PCI_REGION_MEM ) { +if ((flags &PCI_REGION_TYPE ) ==PCI_REGION_MEM ) { ret =__pci_hose_bus_to_phys (hose, bus_addr, flags,PCI_REGION_SYS_MEMORY , &phys_addr);if (!ret)
Signature · 1 line
2.5.1
PATCH 1/1 PCI: fix search for suitable memory region
Hi Andre,
Quoted 14 lines · Andre Przywara
Binary ANDing a value with 0 and comparing it against 0 always yields true, I guess that's not intended here.
Use the proper mask value for the memory region type bit.Signed-off-by Andre Przywara <[email protected]>--- drivers/pci/pci_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/pci/pci_common.c +0
-0
drivers/pci/pci_common.c phys_addr_t pci_hose_bus_to_phys(struct pci_controller *hose,
Quoted 9 lines
drivers/pci/pci_common.c +1
-2@@ -231,7 +231,7 @@ phys_addr_t pci_hose_bus_to_phys(struct pci_controller *hose,* if PCI_REGION_MEM is set we do a two pass search with preference * on matches that don't have PCI_REGION_SYS_MEMORY set */ -if ((flags &PCI_REGION_MEM ) ==PCI_REGION_MEM ) { +if ((flags &PCI_REGION_TYPE ) ==PCI_REGION_MEM ) { ret =__pci_hose_bus_to_phys (hose, bus_addr, flags,PCI_REGION_SYS_MEMORY , &phys_addr);if (!ret) --
See commit 3526285068598f4e2ddaf19d4bd94f253de06ce9 "pci: fix checking PCI_REGION_MEM in pci_hose_phys_to_bus()" which is already in the mainline.
Regards,
Bin
PATCH 1/1 PCI: fix search for suitable memory region
Hi Bin,
Quoted 22 lines · Bin Meng
Hi Andre,
Quoted 19 lines · Andre Przywara
Binary ANDing a value with 0 and comparing it against 0 always yields true, I guess that's not intended here.
Use the proper mask value for the memory region type bit.Signed-off-by Andre Przywara <[email protected]>--- drivers/pci/pci_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/pci/pci_common.c +1
-1@@ -231,7 +231,7 @@ phys_addr_t pci_hose_bus_to_phys(struct pci_controller *hose,* if PCI_REGION_MEM is set we do a two pass search with preference * on matches that don't have PCI_REGION_SYS_MEMORY set */ -if ((flags &PCI_REGION_MEM ) ==PCI_REGION_MEM ) { +if ((flags &PCI_REGION_TYPE ) ==PCI_REGION_MEM ) {
Quoted 8 lines
drivers/pci/pci_common.c phys_addr_t pci_hose_bus_to_phys(struct pci_controller *hose,
Quoted 4 lines
drivers/pci/pci_common.c +0
-1ret =__pci_hose_bus_to_phys (hose, bus_addr, flags,PCI_REGION_SYS_MEMORY , &phys_addr);if (!ret) --See commit
3526285068598f4e2ddaf19d4bd94f253de06ce9"pci: fix checkingPCI_REGION_MEMinpci_hose_phys_to_bus()" which is already in the mainline.
Ah, sorry, I missed that one (forgot updating the master branch). Thanks for pointing this out!
Cheers,
Andre.