diff options
Diffstat (limited to 'drivers/pci/hotplug/ibmphp_pci.c')
-rw-r--r-- | drivers/pci/hotplug/ibmphp_pci.c | 76 |
1 files changed, 21 insertions, 55 deletions
diff --git a/drivers/pci/hotplug/ibmphp_pci.c b/drivers/pci/hotplug/ibmphp_pci.c index 25edd0b18b75..e22d023f91d1 100644 --- a/drivers/pci/hotplug/ibmphp_pci.c +++ b/drivers/pci/hotplug/ibmphp_pci.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0+ | ||
1 | /* | 2 | /* |
2 | * IBM Hot Plug Controller Driver | 3 | * IBM Hot Plug Controller Driver |
3 | * | 4 | * |
@@ -8,21 +9,6 @@ | |||
8 | * | 9 | * |
9 | * All rights reserved. | 10 | * All rights reserved. |
10 | * | 11 | * |
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of the GNU General Public License as published by | ||
13 | * the Free Software Foundation; either version 2 of the License, or (at | ||
14 | * your option) any later version. | ||
15 | * | ||
16 | * This program is distributed in the hope that it will be useful, but | ||
17 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
18 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | ||
19 | * NON INFRINGEMENT. See the GNU General Public License for more | ||
20 | * details. | ||
21 | * | ||
22 | * You should have received a copy of the GNU General Public License | ||
23 | * along with this program; if not, write to the Free Software | ||
24 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
25 | * | ||
26 | * Send feedback to <gregkh@us.ibm.com> | 12 | * Send feedback to <gregkh@us.ibm.com> |
27 | * | 13 | * |
28 | */ | 14 | */ |
@@ -167,10 +153,9 @@ int ibmphp_configure_card(struct pci_func *func, u8 slotno) | |||
167 | goto error; | 153 | goto error; |
168 | } | 154 | } |
169 | newfunc = kzalloc(sizeof(*newfunc), GFP_KERNEL); | 155 | newfunc = kzalloc(sizeof(*newfunc), GFP_KERNEL); |
170 | if (!newfunc) { | 156 | if (!newfunc) |
171 | err("out of system memory\n"); | ||
172 | return -ENOMEM; | 157 | return -ENOMEM; |
173 | } | 158 | |
174 | newfunc->busno = cur_func->busno; | 159 | newfunc->busno = cur_func->busno; |
175 | newfunc->device = device; | 160 | newfunc->device = device; |
176 | cur_func->next = newfunc; | 161 | cur_func->next = newfunc; |
@@ -205,10 +190,9 @@ int ibmphp_configure_card(struct pci_func *func, u8 slotno) | |||
205 | for (i = 0; i < 32; i++) { | 190 | for (i = 0; i < 32; i++) { |
206 | if (func->devices[i]) { | 191 | if (func->devices[i]) { |
207 | newfunc = kzalloc(sizeof(*newfunc), GFP_KERNEL); | 192 | newfunc = kzalloc(sizeof(*newfunc), GFP_KERNEL); |
208 | if (!newfunc) { | 193 | if (!newfunc) |
209 | err("out of system memory\n"); | ||
210 | return -ENOMEM; | 194 | return -ENOMEM; |
211 | } | 195 | |
212 | newfunc->busno = sec_number; | 196 | newfunc->busno = sec_number; |
213 | newfunc->device = (u8) i; | 197 | newfunc->device = (u8) i; |
214 | for (j = 0; j < 4; j++) | 198 | for (j = 0; j < 4; j++) |
@@ -233,10 +217,9 @@ int ibmphp_configure_card(struct pci_func *func, u8 slotno) | |||
233 | } | 217 | } |
234 | 218 | ||
235 | newfunc = kzalloc(sizeof(*newfunc), GFP_KERNEL); | 219 | newfunc = kzalloc(sizeof(*newfunc), GFP_KERNEL); |
236 | if (!newfunc) { | 220 | if (!newfunc) |
237 | err("out of system memory\n"); | ||
238 | return -ENOMEM; | 221 | return -ENOMEM; |
239 | } | 222 | |
240 | newfunc->busno = cur_func->busno; | 223 | newfunc->busno = cur_func->busno; |
241 | newfunc->device = device; | 224 | newfunc->device = device; |
242 | for (j = 0; j < 4; j++) | 225 | for (j = 0; j < 4; j++) |
@@ -279,10 +262,9 @@ int ibmphp_configure_card(struct pci_func *func, u8 slotno) | |||
279 | if (func->devices[i]) { | 262 | if (func->devices[i]) { |
280 | debug("inside for loop, device is %x\n", i); | 263 | debug("inside for loop, device is %x\n", i); |
281 | newfunc = kzalloc(sizeof(*newfunc), GFP_KERNEL); | 264 | newfunc = kzalloc(sizeof(*newfunc), GFP_KERNEL); |
282 | if (!newfunc) { | 265 | if (!newfunc) |
283 | err(" out of system memory\n"); | ||
284 | return -ENOMEM; | 266 | return -ENOMEM; |
285 | } | 267 | |
286 | newfunc->busno = sec_number; | 268 | newfunc->busno = sec_number; |
287 | newfunc->device = (u8) i; | 269 | newfunc->device = (u8) i; |
288 | for (j = 0; j < 4; j++) | 270 | for (j = 0; j < 4; j++) |
@@ -405,10 +387,9 @@ static int configure_device(struct pci_func *func) | |||
405 | 387 | ||
406 | io[count] = kzalloc(sizeof(struct resource_node), GFP_KERNEL); | 388 | io[count] = kzalloc(sizeof(struct resource_node), GFP_KERNEL); |
407 | 389 | ||
408 | if (!io[count]) { | 390 | if (!io[count]) |
409 | err("out of system memory\n"); | ||
410 | return -ENOMEM; | 391 | return -ENOMEM; |
411 | } | 392 | |
412 | io[count]->type = IO; | 393 | io[count]->type = IO; |
413 | io[count]->busno = func->busno; | 394 | io[count]->busno = func->busno; |
414 | io[count]->devfunc = PCI_DEVFN(func->device, func->function); | 395 | io[count]->devfunc = PCI_DEVFN(func->device, func->function); |
@@ -442,10 +423,9 @@ static int configure_device(struct pci_func *func) | |||
442 | debug("len[count] in PFMEM %x, count %d\n", len[count], count); | 423 | debug("len[count] in PFMEM %x, count %d\n", len[count], count); |
443 | 424 | ||
444 | pfmem[count] = kzalloc(sizeof(struct resource_node), GFP_KERNEL); | 425 | pfmem[count] = kzalloc(sizeof(struct resource_node), GFP_KERNEL); |
445 | if (!pfmem[count]) { | 426 | if (!pfmem[count]) |
446 | err("out of system memory\n"); | ||
447 | return -ENOMEM; | 427 | return -ENOMEM; |
448 | } | 428 | |
449 | pfmem[count]->type = PFMEM; | 429 | pfmem[count]->type = PFMEM; |
450 | pfmem[count]->busno = func->busno; | 430 | pfmem[count]->busno = func->busno; |
451 | pfmem[count]->devfunc = PCI_DEVFN(func->device, | 431 | pfmem[count]->devfunc = PCI_DEVFN(func->device, |
@@ -458,7 +438,6 @@ static int configure_device(struct pci_func *func) | |||
458 | } else { | 438 | } else { |
459 | mem_tmp = kzalloc(sizeof(*mem_tmp), GFP_KERNEL); | 439 | mem_tmp = kzalloc(sizeof(*mem_tmp), GFP_KERNEL); |
460 | if (!mem_tmp) { | 440 | if (!mem_tmp) { |
461 | err("out of system memory\n"); | ||
462 | kfree(pfmem[count]); | 441 | kfree(pfmem[count]); |
463 | return -ENOMEM; | 442 | return -ENOMEM; |
464 | } | 443 | } |
@@ -508,10 +487,9 @@ static int configure_device(struct pci_func *func) | |||
508 | debug("len[count] in Mem %x, count %d\n", len[count], count); | 487 | debug("len[count] in Mem %x, count %d\n", len[count], count); |
509 | 488 | ||
510 | mem[count] = kzalloc(sizeof(struct resource_node), GFP_KERNEL); | 489 | mem[count] = kzalloc(sizeof(struct resource_node), GFP_KERNEL); |
511 | if (!mem[count]) { | 490 | if (!mem[count]) |
512 | err("out of system memory\n"); | ||
513 | return -ENOMEM; | 491 | return -ENOMEM; |
514 | } | 492 | |
515 | mem[count]->type = MEM; | 493 | mem[count]->type = MEM; |
516 | mem[count]->busno = func->busno; | 494 | mem[count]->busno = func->busno; |
517 | mem[count]->devfunc = PCI_DEVFN(func->device, | 495 | mem[count]->devfunc = PCI_DEVFN(func->device, |
@@ -674,7 +652,6 @@ static int configure_bridge(struct pci_func **func_passed, u8 slotno) | |||
674 | bus_io[count] = kzalloc(sizeof(struct resource_node), GFP_KERNEL); | 652 | bus_io[count] = kzalloc(sizeof(struct resource_node), GFP_KERNEL); |
675 | 653 | ||
676 | if (!bus_io[count]) { | 654 | if (!bus_io[count]) { |
677 | err("out of system memory\n"); | ||
678 | retval = -ENOMEM; | 655 | retval = -ENOMEM; |
679 | goto error; | 656 | goto error; |
680 | } | 657 | } |
@@ -706,7 +683,6 @@ static int configure_bridge(struct pci_func **func_passed, u8 slotno) | |||
706 | 683 | ||
707 | bus_pfmem[count] = kzalloc(sizeof(struct resource_node), GFP_KERNEL); | 684 | bus_pfmem[count] = kzalloc(sizeof(struct resource_node), GFP_KERNEL); |
708 | if (!bus_pfmem[count]) { | 685 | if (!bus_pfmem[count]) { |
709 | err("out of system memory\n"); | ||
710 | retval = -ENOMEM; | 686 | retval = -ENOMEM; |
711 | goto error; | 687 | goto error; |
712 | } | 688 | } |
@@ -722,7 +698,6 @@ static int configure_bridge(struct pci_func **func_passed, u8 slotno) | |||
722 | } else { | 698 | } else { |
723 | mem_tmp = kzalloc(sizeof(*mem_tmp), GFP_KERNEL); | 699 | mem_tmp = kzalloc(sizeof(*mem_tmp), GFP_KERNEL); |
724 | if (!mem_tmp) { | 700 | if (!mem_tmp) { |
725 | err("out of system memory\n"); | ||
726 | retval = -ENOMEM; | 701 | retval = -ENOMEM; |
727 | goto error; | 702 | goto error; |
728 | } | 703 | } |
@@ -763,7 +738,6 @@ static int configure_bridge(struct pci_func **func_passed, u8 slotno) | |||
763 | 738 | ||
764 | bus_mem[count] = kzalloc(sizeof(struct resource_node), GFP_KERNEL); | 739 | bus_mem[count] = kzalloc(sizeof(struct resource_node), GFP_KERNEL); |
765 | if (!bus_mem[count]) { | 740 | if (!bus_mem[count]) { |
766 | err("out of system memory\n"); | ||
767 | retval = -ENOMEM; | 741 | retval = -ENOMEM; |
768 | goto error; | 742 | goto error; |
769 | } | 743 | } |
@@ -834,7 +808,6 @@ static int configure_bridge(struct pci_func **func_passed, u8 slotno) | |||
834 | io = kzalloc(sizeof(*io), GFP_KERNEL); | 808 | io = kzalloc(sizeof(*io), GFP_KERNEL); |
835 | 809 | ||
836 | if (!io) { | 810 | if (!io) { |
837 | err("out of system memory\n"); | ||
838 | retval = -ENOMEM; | 811 | retval = -ENOMEM; |
839 | goto error; | 812 | goto error; |
840 | } | 813 | } |
@@ -856,7 +829,6 @@ static int configure_bridge(struct pci_func **func_passed, u8 slotno) | |||
856 | debug("it wants %x memory behind the bridge\n", amount_needed->mem); | 829 | debug("it wants %x memory behind the bridge\n", amount_needed->mem); |
857 | mem = kzalloc(sizeof(*mem), GFP_KERNEL); | 830 | mem = kzalloc(sizeof(*mem), GFP_KERNEL); |
858 | if (!mem) { | 831 | if (!mem) { |
859 | err("out of system memory\n"); | ||
860 | retval = -ENOMEM; | 832 | retval = -ENOMEM; |
861 | goto error; | 833 | goto error; |
862 | } | 834 | } |
@@ -878,7 +850,6 @@ static int configure_bridge(struct pci_func **func_passed, u8 slotno) | |||
878 | debug("it wants %x pfmemory behind the bridge\n", amount_needed->pfmem); | 850 | debug("it wants %x pfmemory behind the bridge\n", amount_needed->pfmem); |
879 | pfmem = kzalloc(sizeof(*pfmem), GFP_KERNEL); | 851 | pfmem = kzalloc(sizeof(*pfmem), GFP_KERNEL); |
880 | if (!pfmem) { | 852 | if (!pfmem) { |
881 | err("out of system memory\n"); | ||
882 | retval = -ENOMEM; | 853 | retval = -ENOMEM; |
883 | goto error; | 854 | goto error; |
884 | } | 855 | } |
@@ -893,7 +864,6 @@ static int configure_bridge(struct pci_func **func_passed, u8 slotno) | |||
893 | } else { | 864 | } else { |
894 | mem_tmp = kzalloc(sizeof(*mem_tmp), GFP_KERNEL); | 865 | mem_tmp = kzalloc(sizeof(*mem_tmp), GFP_KERNEL); |
895 | if (!mem_tmp) { | 866 | if (!mem_tmp) { |
896 | err("out of system memory\n"); | ||
897 | retval = -ENOMEM; | 867 | retval = -ENOMEM; |
898 | goto error; | 868 | goto error; |
899 | } | 869 | } |
@@ -924,7 +894,6 @@ static int configure_bridge(struct pci_func **func_passed, u8 slotno) | |||
924 | if (!bus) { | 894 | if (!bus) { |
925 | bus = kzalloc(sizeof(*bus), GFP_KERNEL); | 895 | bus = kzalloc(sizeof(*bus), GFP_KERNEL); |
926 | if (!bus) { | 896 | if (!bus) { |
927 | err("out of system memory\n"); | ||
928 | retval = -ENOMEM; | 897 | retval = -ENOMEM; |
929 | goto error; | 898 | goto error; |
930 | } | 899 | } |
@@ -1652,10 +1621,9 @@ static int add_new_bus(struct bus_node *bus, struct resource_node *io, struct re | |||
1652 | } | 1621 | } |
1653 | if (io) { | 1622 | if (io) { |
1654 | io_range = kzalloc(sizeof(*io_range), GFP_KERNEL); | 1623 | io_range = kzalloc(sizeof(*io_range), GFP_KERNEL); |
1655 | if (!io_range) { | 1624 | if (!io_range) |
1656 | err("out of system memory\n"); | ||
1657 | return -ENOMEM; | 1625 | return -ENOMEM; |
1658 | } | 1626 | |
1659 | io_range->start = io->start; | 1627 | io_range->start = io->start; |
1660 | io_range->end = io->end; | 1628 | io_range->end = io->end; |
1661 | io_range->rangeno = 1; | 1629 | io_range->rangeno = 1; |
@@ -1664,10 +1632,9 @@ static int add_new_bus(struct bus_node *bus, struct resource_node *io, struct re | |||
1664 | } | 1632 | } |
1665 | if (mem) { | 1633 | if (mem) { |
1666 | mem_range = kzalloc(sizeof(*mem_range), GFP_KERNEL); | 1634 | mem_range = kzalloc(sizeof(*mem_range), GFP_KERNEL); |
1667 | if (!mem_range) { | 1635 | if (!mem_range) |
1668 | err("out of system memory\n"); | ||
1669 | return -ENOMEM; | 1636 | return -ENOMEM; |
1670 | } | 1637 | |
1671 | mem_range->start = mem->start; | 1638 | mem_range->start = mem->start; |
1672 | mem_range->end = mem->end; | 1639 | mem_range->end = mem->end; |
1673 | mem_range->rangeno = 1; | 1640 | mem_range->rangeno = 1; |
@@ -1676,10 +1643,9 @@ static int add_new_bus(struct bus_node *bus, struct resource_node *io, struct re | |||
1676 | } | 1643 | } |
1677 | if (pfmem) { | 1644 | if (pfmem) { |
1678 | pfmem_range = kzalloc(sizeof(*pfmem_range), GFP_KERNEL); | 1645 | pfmem_range = kzalloc(sizeof(*pfmem_range), GFP_KERNEL); |
1679 | if (!pfmem_range) { | 1646 | if (!pfmem_range) |
1680 | err("out of system memory\n"); | ||
1681 | return -ENOMEM; | 1647 | return -ENOMEM; |
1682 | } | 1648 | |
1683 | pfmem_range->start = pfmem->start; | 1649 | pfmem_range->start = pfmem->start; |
1684 | pfmem_range->end = pfmem->end; | 1650 | pfmem_range->end = pfmem->end; |
1685 | pfmem_range->rangeno = 1; | 1651 | pfmem_range->rangeno = 1; |