+
+error_name:
+ kfree(slot->hotplug_slot->name);
+error_info:
+ kfree(slot->hotplug_slot->info);
+error_hpslot:
+ kfree(slot->hotplug_slot);
+error_slot:
+ kfree(slot);
+error_nomem:
+ return NULL;
+}
+
+static int is_registered(struct slot *slot)
+{
+ struct slot *tmp_slot;
+
+ list_for_each_entry(tmp_slot, &rpaphp_slot_head, rpaphp_slot_list) {
+ if (!strcmp(tmp_slot->name, slot->name))
+ return 1;
+ }
+ return 0;
+}
+
+int deregister_slot(struct slot *slot)
+{
+ int retval = 0;
+ struct hotplug_slot *php_slot = slot->hotplug_slot;
+
+ dbg("%s - Entry: deregistering slot=%s\n",
+ __FUNCTION__, slot->name);
+
+ list_del(&slot->rpaphp_slot_list);
+
+ /* remove "phy_location" file */
+ rpaphp_sysfs_remove_attr_location(php_slot);
+
+ /* remove "phy_removable" file */
+ rpaphp_sysfs_remove_attr_removable(php_slot);
+
+ retval = pci_hp_deregister(php_slot);
+ if (retval)
+ err("Problem unregistering a slot %s\n", slot->name);
+ else
+ num_slots--;
+
+ dbg("%s - Exit: rc[%d]\n", __FUNCTION__, retval);
+ return retval;