Re: 2.6.25-rc8-mm1 panic in rpaphp_register_slot()

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Alex Chiang
Date: Monday, April 7, 2008 - 4:42 pm

Hi Badari,


This patch is a complete guess on my part (since I've not been
able to understand pseries architecture) but I think it should
fix your issue.

Can you give it a try and let me know? It applies on top of the
-mm tree that includes my physical pci_slot series.

Also, I'm hoping Linas will speak up and let me know what the
real answer might be. ;)

Thanks.

/ac

From: Alex Chiang <achiang@hp.com>
Subject: rpaphp: correctly call pci_hp_register for empty PCI slots

Unpopulated device_node slots do not have children, and
attempting to dereference them will result in a panic.

Instead, attempt to derive the PCI slot number from the bus
itself, and failing that, default to 0.

Signed-off-by: Alex Chiang <achiang@hp.com>
---
diff --git a/drivers/pci/hotplug/rpaphp_slot.c b/drivers/pci/hotplug/rpaphp_slot.c
index 0d4cfc7..91ce6a6 100644
--- a/drivers/pci/hotplug/rpaphp_slot.c
+++ b/drivers/pci/hotplug/rpaphp_slot.c
@@ -121,6 +121,7 @@ int rpaphp_register_slot(struct slot *slot)
 {
 	struct hotplug_slot *php_slot = slot->hotplug_slot;
 	int retval;
+	int slot_nr;
 
 	dbg("%s registering slot:path[%s] index[%x], name[%s] pdomain[%x] type[%d]\n", 
 		__FUNCTION__, slot->dn->full_name, slot->index, slot->name, 
@@ -132,8 +133,11 @@ int rpaphp_register_slot(struct slot *slot)
 		return -EAGAIN;
 	}	
 
-	retval = pci_hp_register(php_slot, slot->bus,
-				 PCI_SLOT(PCI_DN(slot->dn->child)->devfn));
+	if (slot->bus->self)
+		slot_nr = PCI_SLOT(slot->bus->self->devfn);
+	else
+		slot_nr = 0;
+	retval = pci_hp_register(php_slot, slot->bus, slot_nr);
 	if (retval) {
 		err("pci_hp_register failed with error %d\n", retval);
 		return retval;
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
2.6.25-rc8-mm1 panic in rpaphp_register_slot(), Badari Pulavarty, (Fri Apr 4, 10:53 am)
Re: 2.6.25-rc8-mm1 panic in rpaphp_register_slot(), Alex Chiang, (Fri Apr 4, 11:05 am)
Re: 2.6.25-rc8-mm1 panic in rpaphp_register_slot(), Badari Pulavarty, (Fri Apr 4, 1:19 pm)
Re: 2.6.25-rc8-mm1 panic in rpaphp_register_slot(), Alex Chiang, (Fri Apr 4, 3:42 pm)
Re: 2.6.25-rc8-mm1 panic in rpaphp_register_slot(), Badari Pulavarty, (Fri Apr 4, 4:35 pm)
Re: 2.6.25-rc8-mm1 panic in rpaphp_register_slot(), Alex Chiang, (Mon Apr 7, 4:42 pm)
Re: 2.6.25-rc8-mm1 panic in rpaphp_register_slot(), Andrew Morton, (Tue Apr 15, 5:36 pm)
Re: 2.6.25-rc8-mm1 panic in rpaphp_register_slot(), Alex Chiang, (Tue Apr 15, 7:13 pm)
Re: 2.6.25-rc8-mm1 panic in rpaphp_register_slot(), Badari Pulavarty, (Tue Apr 15, 8:08 pm)
Re: 2.6.25-rc8-mm1 panic in rpaphp_register_slot(), Alex Chiang, (Tue Apr 15, 8:17 pm)
Re: 2.6.25-rc8-mm1 panic in rpaphp_register_slot(), Alex Chiang, (Tue Apr 15, 8:18 pm)
Re: 2.6.25-rc8-mm1 panic in rpaphp_register_slot(), Badari Pulavarty, (Tue Apr 15, 8:20 pm)
Re: 2.6.25-rc8-mm1 panic in rpaphp_register_slot(), Benjamin Herrenschmidt, (Wed Apr 16, 12:45 am)
Re: 2.6.25-rc8-mm1 panic in rpaphp_register_slot(), Alex Chiang, (Wed Apr 16, 10:11 am)
Re: 2.6.25-rc8-mm1 panic in rpaphp_register_slot(), Badari Pulavarty, (Wed Apr 16, 12:32 pm)
Re: 2.6.25-rc8-mm1 panic in rpaphp_register_slot(), Alex Chiang, (Wed Apr 16, 12:59 pm)
Re: 2.6.25-rc8-mm1 panic in rpaphp_register_slot(), Andrew Morton, (Wed Apr 16, 1:03 pm)
Re: 2.6.25-rc8-mm1 panic in rpaphp_register_slot(), Benjamin Herrenschmidt, (Wed Apr 16, 3:15 pm)
Re: 2.6.25-rc8-mm1 panic in rpaphp_register_slot(), Benjamin Herrenschmidt, (Wed Apr 16, 3:16 pm)
Re: 2.6.25-rc8-mm1 panic in rpaphp_register_slot(), Alex Chiang, (Fri Apr 18, 11:38 pm)
Re: 2.6.25-rc8-mm1 panic in rpaphp_register_slot(), Benjamin Herrenschmidt, (Sat Apr 19, 12:03 am)
Re: 2.6.25-rc8-mm1 panic in rpaphp_register_slot(), Alex Chiang, (Mon Apr 21, 9:05 pm)
Re: 2.6.25-rc8-mm1 panic in rpaphp_register_slot(), Benjamin Herrenschmidt, (Mon Apr 21, 10:07 pm)