mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] PCI: fix bad bugs in bridge setup code
@ 2015-03-13 10:28 Lucas Stach
  2015-03-16  4:29 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Lucas Stach @ 2015-03-13 10:28 UTC (permalink / raw)
  To: barebox

Add the required brackets, so that we don't write unused registers
with potentially bogus values.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
/me hides under a rock
---
 drivers/pci/pci.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 5b848eeb2a53..1f5dc78b3ce1 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -259,15 +259,17 @@ static void postscan_setup_bridge(struct pci_dev *dev)
 	/* limit subordinate to last used bus number */
 	pci_write_config_byte(dev, PCI_SUBORDINATE_BUS, bus_index - 1);
 
-	if (last_mem)
+	if (last_mem) {
 		last_mem = ALIGN(last_mem, SZ_1M);
 		pci_write_config_word(dev, PCI_MEMORY_LIMIT,
 				      ((last_mem - 1) & 0xfff00000) >> 16);
+	}
 
-	if (last_mem_pref)
+	if (last_mem_pref) {
 		last_mem_pref = ALIGN(last_mem_pref, SZ_1M);
 		pci_write_config_word(dev, PCI_PREF_MEMORY_LIMIT,
 				      ((last_mem_pref - 1) & 0xfff00000) >> 16);
+	}
 
 	if (last_io) {
 		last_io = ALIGN(last_io, SZ_4K);
-- 
2.1.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-03-16  4:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-13 10:28 [PATCH] PCI: fix bad bugs in bridge setup code Lucas Stach
2015-03-16  4:29 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox