diff options
-rw-r--r-- | drivers/pci/hotplug/pci_hotplug_core.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/pci/hotplug/pci_hotplug_core.c b/drivers/pci/hotplug/pci_hotplug_core.c index 925ba16355ce..a11021e8ce37 100644 --- a/drivers/pci/hotplug/pci_hotplug_core.c +++ b/drivers/pci/hotplug/pci_hotplug_core.c | |||
@@ -619,6 +619,7 @@ static struct hotplug_slot *get_slot_from_name (const char *name) | |||
619 | int pci_hp_register (struct hotplug_slot *slot) | 619 | int pci_hp_register (struct hotplug_slot *slot) |
620 | { | 620 | { |
621 | int result; | 621 | int result; |
622 | struct hotplug_slot *tmp; | ||
622 | 623 | ||
623 | if (slot == NULL) | 624 | if (slot == NULL) |
624 | return -ENODEV; | 625 | return -ENODEV; |
@@ -630,7 +631,11 @@ int pci_hp_register (struct hotplug_slot *slot) | |||
630 | return -EINVAL; | 631 | return -EINVAL; |
631 | } | 632 | } |
632 | 633 | ||
633 | /* this can fail if we have already registered a slot with the same name */ | 634 | /* Check if we have already registered a slot with the same name. */ |
635 | tmp = get_slot_from_name(slot->name); | ||
636 | if (tmp) | ||
637 | return -EEXIST; | ||
638 | |||
634 | slot->kobj.kset = pci_hotplug_slots_kset; | 639 | slot->kobj.kset = pci_hotplug_slots_kset; |
635 | result = kobject_init_and_add(&slot->kobj, &hotplug_slot_ktype, NULL, | 640 | result = kobject_init_and_add(&slot->kobj, &hotplug_slot_ktype, NULL, |
636 | "%s", slot->name); | 641 | "%s", slot->name); |