aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/hotplug/sgi_hotplug.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/hotplug/sgi_hotplug.c')
-rw-r--r--drivers/pci/hotplug/sgi_hotplug.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/drivers/pci/hotplug/sgi_hotplug.c b/drivers/pci/hotplug/sgi_hotplug.c
index 6d20bbd4359a..d748698e31a2 100644
--- a/drivers/pci/hotplug/sgi_hotplug.c
+++ b/drivers/pci/hotplug/sgi_hotplug.c
@@ -161,7 +161,8 @@ static int sn_pci_bus_valid(struct pci_bus *pci_bus)
161} 161}
162 162
163static int sn_hp_slot_private_alloc(struct hotplug_slot *bss_hotplug_slot, 163static int sn_hp_slot_private_alloc(struct hotplug_slot *bss_hotplug_slot,
164 struct pci_bus *pci_bus, int device) 164 struct pci_bus *pci_bus, int device,
165 char *name)
165{ 166{
166 struct pcibus_info *pcibus_info; 167 struct pcibus_info *pcibus_info;
167 struct slot *slot; 168 struct slot *slot;
@@ -173,15 +174,9 @@ static int sn_hp_slot_private_alloc(struct hotplug_slot *bss_hotplug_slot,
173 return -ENOMEM; 174 return -ENOMEM;
174 bss_hotplug_slot->private = slot; 175 bss_hotplug_slot->private = slot;
175 176
176 bss_hotplug_slot->name = kmalloc(SN_SLOT_NAME_SIZE, GFP_KERNEL);
177 if (!bss_hotplug_slot->name) {
178 kfree(bss_hotplug_slot->private);
179 return -ENOMEM;
180 }
181
182 slot->device_num = device; 177 slot->device_num = device;
183 slot->pci_bus = pci_bus; 178 slot->pci_bus = pci_bus;
184 sprintf(bss_hotplug_slot->name, "%04x:%02x:%02x", 179 sprintf(name, "%04x:%02x:%02x",
185 pci_domain_nr(pci_bus), 180 pci_domain_nr(pci_bus),
186 ((u16)pcibus_info->pbi_buscommon.bs_persist_busnum), 181 ((u16)pcibus_info->pbi_buscommon.bs_persist_busnum),
187 device + 1); 182 device + 1);
@@ -608,7 +603,6 @@ static inline int get_power_status(struct hotplug_slot *bss_hotplug_slot,
608static void sn_release_slot(struct hotplug_slot *bss_hotplug_slot) 603static void sn_release_slot(struct hotplug_slot *bss_hotplug_slot)
609{ 604{
610 kfree(bss_hotplug_slot->info); 605 kfree(bss_hotplug_slot->info);
611 kfree(bss_hotplug_slot->name);
612 kfree(bss_hotplug_slot->private); 606 kfree(bss_hotplug_slot->private);
613 kfree(bss_hotplug_slot); 607 kfree(bss_hotplug_slot);
614} 608}
@@ -618,6 +612,7 @@ static int sn_hotplug_slot_register(struct pci_bus *pci_bus)
618 int device; 612 int device;
619 struct pci_slot *pci_slot; 613 struct pci_slot *pci_slot;
620 struct hotplug_slot *bss_hotplug_slot; 614 struct hotplug_slot *bss_hotplug_slot;
615 char name[SN_SLOT_NAME_SIZE];
621 int rc = 0; 616 int rc = 0;
622 617
623 /* 618 /*
@@ -645,16 +640,14 @@ static int sn_hotplug_slot_register(struct pci_bus *pci_bus)
645 } 640 }
646 641
647 if (sn_hp_slot_private_alloc(bss_hotplug_slot, 642 if (sn_hp_slot_private_alloc(bss_hotplug_slot,
648 pci_bus, device)) { 643 pci_bus, device, name)) {
649 rc = -ENOMEM; 644 rc = -ENOMEM;
650 goto alloc_err; 645 goto alloc_err;
651 } 646 }
652
653 bss_hotplug_slot->ops = &sn_hotplug_slot_ops; 647 bss_hotplug_slot->ops = &sn_hotplug_slot_ops;
654 bss_hotplug_slot->release = &sn_release_slot; 648 bss_hotplug_slot->release = &sn_release_slot;
655 649
656 rc = pci_hp_register(bss_hotplug_slot, pci_bus, device, 650 rc = pci_hp_register(bss_hotplug_slot, pci_bus, device, name);
657 bss_hotplug_slot->name);
658 if (rc) 651 if (rc)
659 goto register_err; 652 goto register_err;
660 653