Re: [PATCH 5/6]: hotplug/ia64: SN Hotplug Driver - SN Hotplug Driver code

From: Prarit Bhargava <prarit_at_sgi.com>
Date: 2005-05-17 22:47:08
Greg KH wrote:
>>+
>>+	while ((pci_bus = pci_find_next_bus(pci_bus))) {
>>+		if (!pci_bus->sysdata)
>>+			continue;
>>+
>>+		rc = sn_pci_bus_valid(pci_bus);
>>+		if (rc != 1) {
>>+			dev_dbg(pci_bus->self, "not a valid hotplug bus\n");
>>+			continue;
>>+		}
>>+		dev_dbg(pci_bus->self, "valid hotplug bus\n");
>>+
>>+		rc = sn_hotplug_slot_register(pci_bus);
>>+		if (!rc)
>>+			registered = 1;
>>+		else {
>>+			registered = 0;
>>+			break;
>>+		}
>>+	}
> 
> 
> How do you recover if you fail the second (or third, or fourth) hotplug bus register?  It
> looks like the code will die a horrible death...
> 

Greg,

The return of sn_hotplug_slot_register is an indication of whether or not all 
slots had been properly registered.

The error handling is in sn_hotplug_slot_register.  If I fail a second, or 
third, or an nth hotplug register, the clean up is done in the following code 
(from sn_hotplug_slot_register).

+               rc = pci_hp_register(bss_hotplug_slot);
+               if (rc)
+                       goto register_err;
+       }
+       dev_dbg(pci_bus->self, "Registered bus with hotplug\n");
+       return rc;
+
+register_err:
+       dev_dbg(pci_bus->self, "bus failed to register with err = %d\n",
+               rc);
+
+alloc_err:
+       if (rc == -ENOMEM)
+               dev_dbg(pci_bus->self, "Memory allocation error\n");
+
+       /* destroy THIS element */
+       if (bss_hotplug_slot)
+               sn_release_slot(bss_hotplug_slot);
+
+       /* destroy anything else on the list */
+       while ((bss_hotplug_slot = sn_hp_destroy()))
+               pci_hp_deregister(bss_hotplug_slot);
+
+       return rc;
+}

P.
-
To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Tue May 17 08:47:49 2005

This archive was generated by hypermail 2.1.8 : 2005-08-02 09:20:39 EST