Skip to contentSkip to conversation

2.5.18: unnamed PCI bus resources

PATCH New Ivan Kokshaysky 1 participant 1 message May 28, 2002 PCI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 2.5.18: unnamed PCI bus resources

As pointed out by Russell King, resource name pointers of the secondary PCI buses are left uninitialized in the non-x86 PCI allocation path.
Assigning these pointers in pci_add_new_bus() fixes the problem.

Ivan.

drivers/pci/probe.c +4 -5
@@ -151,7 +151,6 @@ void __devinit pci_read_bridge_bases(str
 		res->flags = (io_base_lo & PCI_IO_RANGE_TYPE_MASK) | IORESOURCE_IO;
 		res->start = base;
 		res->end = limit + 0xfff;
-		res->name = child->name;
 	} else {
 		/*
 		 * Ugh. We don't know enough about this bridge. Just assume
@@ -170,7 +169,6 @@ void __devinit pci_read_bridge_bases(str
 		res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM;
 		res->start = base;
 		res->end = limit + 0xfffff;
-		res->name = child->name;
 	} else {
 		/* See comment above. Same thing */
 		printk(KERN_ERR "Unknown bridge resource %d: assuming transparent\n", 1);
@@ -201,7 +199,6 @@ void __devinit pci_read_bridge_bases(str
 		res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM | IORESOURCE_PREFETCH;
 		res->start = base;
 		res->end = limit + 0xfffff;
-		res->name = child->name;
 	} else {
 		/* See comments above */
 		printk(KERN_ERR "Unknown bridge resource %d: assuming transparent\n", 2);
@@ -248,9 +245,11 @@ struct pci_bus * __devinit pci_add_new_b
 	child->primary = parent->secondary;
 	child->subordinate = 0xff;
 
-	/* Set up default resource pointers.. */
-	for (i = 0; i < 4; i++)
+	/* Set up default resource pointers and names.. */
+	for (i = 0; i < 4; i++) {
 		child->resource[i] = &dev->resource[PCI_BRIDGE_RESOURCES+i];
+		child->resource[i]->name = child->name;
+	}
 
 	return child;
 }