aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/hotplug/ibmphp_core.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/hotplug/ibmphp_core.c')
-rw-r--r--drivers/pci/hotplug/ibmphp_core.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/drivers/pci/hotplug/ibmphp_core.c b/drivers/pci/hotplug/ibmphp_core.c
index 87b6b8b280e6..c892daae74d6 100644
--- a/drivers/pci/hotplug/ibmphp_core.c
+++ b/drivers/pci/hotplug/ibmphp_core.c
@@ -148,8 +148,10 @@ int ibmphp_init_devno(struct slot **cur_slot)
148 len = (rtable->size - sizeof(struct irq_routing_table)) / 148 len = (rtable->size - sizeof(struct irq_routing_table)) /
149 sizeof(struct irq_info); 149 sizeof(struct irq_info);
150 150
151 if (!len) 151 if (!len) {
152 kfree(rtable);
152 return -1; 153 return -1;
154 }
153 for (loop = 0; loop < len; loop++) { 155 for (loop = 0; loop < len; loop++) {
154 if ((*cur_slot)->number == rtable->slots[loop].slot) { 156 if ((*cur_slot)->number == rtable->slots[loop].slot) {
155 if ((*cur_slot)->bus == rtable->slots[loop].bus) { 157 if ((*cur_slot)->bus == rtable->slots[loop].bus) {
@@ -187,11 +189,13 @@ int ibmphp_init_devno(struct slot **cur_slot)
187 debug("rtable->slots[loop].irq[3].link = %x\n", 189 debug("rtable->slots[loop].irq[3].link = %x\n",
188 rtable->slots[loop].irq[3].link); 190 rtable->slots[loop].irq[3].link);
189 debug("end of init_devno\n"); 191 debug("end of init_devno\n");
192 kfree(rtable);
190 return 0; 193 return 0;
191 } 194 }
192 } 195 }
193 } 196 }
194 197
198 kfree(rtable);
195 return -1; 199 return -1;
196} 200}
197 201
@@ -395,7 +399,7 @@ static int get_max_bus_speed(struct hotplug_slot *hotplug_slot, enum pci_bus_spe
395 struct slot *pslot; 399 struct slot *pslot;
396 u8 mode = 0; 400 u8 mode = 0;
397 401
398 debug("%s - Entry hotplug_slot[%p] pvalue[%p]\n", __FUNCTION__, 402 debug("%s - Entry hotplug_slot[%p] pvalue[%p]\n", __func__,
399 hotplug_slot, value); 403 hotplug_slot, value);
400 404
401 ibmphp_lock_operations(); 405 ibmphp_lock_operations();
@@ -425,7 +429,7 @@ static int get_max_bus_speed(struct hotplug_slot *hotplug_slot, enum pci_bus_spe
425 } 429 }
426 430
427 ibmphp_unlock_operations(); 431 ibmphp_unlock_operations();
428 debug("%s - Exit rc[%d] value[%x]\n", __FUNCTION__, rc, *value); 432 debug("%s - Exit rc[%d] value[%x]\n", __func__, rc, *value);
429 return rc; 433 return rc;
430} 434}
431 435
@@ -435,7 +439,7 @@ static int get_cur_bus_speed(struct hotplug_slot *hotplug_slot, enum pci_bus_spe
435 struct slot *pslot; 439 struct slot *pslot;
436 u8 mode = 0; 440 u8 mode = 0;
437 441
438 debug("%s - Entry hotplug_slot[%p] pvalue[%p]\n", __FUNCTION__, 442 debug("%s - Entry hotplug_slot[%p] pvalue[%p]\n", __func__,
439 hotplug_slot, value); 443 hotplug_slot, value);
440 444
441 ibmphp_lock_operations(); 445 ibmphp_lock_operations();
@@ -471,7 +475,7 @@ static int get_cur_bus_speed(struct hotplug_slot *hotplug_slot, enum pci_bus_spe
471 } 475 }
472 476
473 ibmphp_unlock_operations(); 477 ibmphp_unlock_operations();
474 debug("%s - Exit rc[%d] value[%x]\n", __FUNCTION__, rc, *value); 478 debug("%s - Exit rc[%d] value[%x]\n", __func__, rc, *value);
475 return rc; 479 return rc;
476} 480}
477 481
@@ -741,13 +745,13 @@ static void free_slots(void)
741 struct list_head * tmp; 745 struct list_head * tmp;
742 struct list_head * next; 746 struct list_head * next;
743 747
744 debug("%s -- enter\n", __FUNCTION__); 748 debug("%s -- enter\n", __func__);
745 749
746 list_for_each_safe(tmp, next, &ibmphp_slot_head) { 750 list_for_each_safe(tmp, next, &ibmphp_slot_head) {
747 slot_cur = list_entry(tmp, struct slot, ibm_slot_list); 751 slot_cur = list_entry(tmp, struct slot, ibm_slot_list);
748 pci_hp_deregister(slot_cur->hotplug_slot); 752 pci_hp_deregister(slot_cur->hotplug_slot);
749 } 753 }
750 debug("%s -- exit\n", __FUNCTION__); 754 debug("%s -- exit\n", __func__);
751} 755}
752 756
753static void ibm_unconfigure_device(struct pci_func *func) 757static void ibm_unconfigure_device(struct pci_func *func)
@@ -755,7 +759,7 @@ static void ibm_unconfigure_device(struct pci_func *func)
755 struct pci_dev *temp; 759 struct pci_dev *temp;
756 u8 j; 760 u8 j;
757 761
758 debug("inside %s\n", __FUNCTION__); 762 debug("inside %s\n", __func__);
759 debug("func->device = %x, func->function = %x\n", 763 debug("func->device = %x, func->function = %x\n",
760 func->device, func->function); 764 func->device, func->function);
761 debug("func->device << 3 | 0x0 = %x\n", func->device << 3 | 0x0); 765 debug("func->device << 3 | 0x0 = %x\n", func->device << 3 | 0x0);
@@ -786,13 +790,13 @@ static u8 bus_structure_fixup(u8 busno)
786 790
787 bus = kmalloc(sizeof(*bus), GFP_KERNEL); 791 bus = kmalloc(sizeof(*bus), GFP_KERNEL);
788 if (!bus) { 792 if (!bus) {
789 err("%s - out of memory\n", __FUNCTION__); 793 err("%s - out of memory\n", __func__);
790 return 1; 794 return 1;
791 } 795 }
792 dev = kmalloc(sizeof(*dev), GFP_KERNEL); 796 dev = kmalloc(sizeof(*dev), GFP_KERNEL);
793 if (!dev) { 797 if (!dev) {
794 kfree(bus); 798 kfree(bus);
795 err("%s - out of memory\n", __FUNCTION__); 799 err("%s - out of memory\n", __func__);
796 return 1; 800 return 1;
797 } 801 }
798 802
@@ -803,7 +807,7 @@ static u8 bus_structure_fixup(u8 busno)
803 if (!pci_read_config_word(dev, PCI_VENDOR_ID, &l) && 807 if (!pci_read_config_word(dev, PCI_VENDOR_ID, &l) &&
804 (l != 0x0000) && (l != 0xffff)) { 808 (l != 0x0000) && (l != 0xffff)) {
805 debug("%s - Inside bus_struture_fixup()\n", 809 debug("%s - Inside bus_struture_fixup()\n",
806 __FUNCTION__); 810 __func__);
807 pci_scan_bus(busno, ibmphp_pci_bus->ops, NULL); 811 pci_scan_bus(busno, ibmphp_pci_bus->ops, NULL);
808 break; 812 break;
809 } 813 }
@@ -900,7 +904,7 @@ static int set_bus(struct slot * slot_cur)
900 { }, 904 { },
901 }; 905 };
902 906
903 debug("%s - entry slot # %d\n", __FUNCTION__, slot_cur->number); 907 debug("%s - entry slot # %d\n", __func__, slot_cur->number);
904 if (SET_BUS_STATUS(slot_cur->ctrl) && is_bus_empty(slot_cur)) { 908 if (SET_BUS_STATUS(slot_cur->ctrl) && is_bus_empty(slot_cur)) {
905 rc = slot_update(&slot_cur); 909 rc = slot_update(&slot_cur);
906 if (rc) 910 if (rc)
@@ -975,7 +979,7 @@ static int set_bus(struct slot * slot_cur)
975 /* This is for x440, once Brandon fixes the firmware, 979 /* This is for x440, once Brandon fixes the firmware,
976 will not need this delay */ 980 will not need this delay */
977 msleep(1000); 981 msleep(1000);
978 debug("%s -Exit\n", __FUNCTION__); 982 debug("%s -Exit\n", __func__);
979 return 0; 983 return 0;
980} 984}
981 985