diff options
Diffstat (limited to 'drivers/pci/hotplug/shpchp_core.c')
-rw-r--r-- | drivers/pci/hotplug/shpchp_core.c | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/drivers/pci/hotplug/shpchp_core.c b/drivers/pci/hotplug/shpchp_core.c index bf5096612aab..cfdd07963641 100644 --- a/drivers/pci/hotplug/shpchp_core.c +++ b/drivers/pci/hotplug/shpchp_core.c | |||
@@ -102,7 +102,7 @@ static int init_slots(struct controller *ctrl) | |||
102 | struct hotplug_slot *hotplug_slot; | 102 | struct hotplug_slot *hotplug_slot; |
103 | struct hotplug_slot_info *info; | 103 | struct hotplug_slot_info *info; |
104 | int retval = -ENOMEM; | 104 | int retval = -ENOMEM; |
105 | int i, len, dup = 1; | 105 | int i; |
106 | 106 | ||
107 | for (i = 0; i < ctrl->num_slots; i++) { | 107 | for (i = 0; i < ctrl->num_slots; i++) { |
108 | slot = kzalloc(sizeof(*slot), GFP_KERNEL); | 108 | slot = kzalloc(sizeof(*slot), GFP_KERNEL); |
@@ -144,23 +144,10 @@ static int init_slots(struct controller *ctrl) | |||
144 | dbg("Registering bus=%x dev=%x hp_slot=%x sun=%x " | 144 | dbg("Registering bus=%x dev=%x hp_slot=%x sun=%x " |
145 | "slot_device_offset=%x\n", slot->bus, slot->device, | 145 | "slot_device_offset=%x\n", slot->bus, slot->device, |
146 | slot->hp_slot, slot->number, ctrl->slot_device_offset); | 146 | slot->hp_slot, slot->number, ctrl->slot_device_offset); |
147 | duplicate_name: | ||
148 | retval = pci_hp_register(slot->hotplug_slot, | 147 | retval = pci_hp_register(slot->hotplug_slot, |
149 | ctrl->pci_dev->subordinate, slot->device, | 148 | ctrl->pci_dev->subordinate, slot->device, |
150 | hotplug_slot->name); | 149 | hotplug_slot->name); |
151 | if (retval) { | 150 | if (retval) { |
152 | /* | ||
153 | * If slot N already exists, we'll try to create | ||
154 | * slot N-1, N-2 ... N-M, until we overflow. | ||
155 | */ | ||
156 | if (retval == -EEXIST) { | ||
157 | len = snprintf(slot->name, SLOT_NAME_SIZE, | ||
158 | "%d-%d", slot->number, dup++); | ||
159 | if (len < SLOT_NAME_SIZE) | ||
160 | goto duplicate_name; | ||
161 | else | ||
162 | err("duplicate slot name overflow\n"); | ||
163 | } | ||
164 | err("pci_hp_register failed with error %d\n", retval); | 151 | err("pci_hp_register failed with error %d\n", retval); |
165 | goto error_info; | 152 | goto error_info; |
166 | } | 153 | } |