aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMarkus Elfring <elfring@users.sourceforge.net>2017-12-29 06:15:16 -0500
committerBjorn Helgaas <bhelgaas@google.com>2018-01-17 09:41:41 -0500
commitc7abb2352c298e8ac2ccfd843f036ae5244d6f35 (patch)
tree7fbfb980fd5bacb12d8a31633a771a0f96a7ef14 /drivers
parentfdabc3fe998203038a78763c1b3d6ace517e0eea (diff)
PCI: Remove unnecessary messages for memory allocation failures
Per ebfdc40969f2 ("checkpatch: attempt to find unnecessary 'out of memory' messages"), when a memory allocation fails, the memory subsystem emits generic "out of memory" messages (see slab_out_of_memory() for some of this logging). Therefore, additional error messages in the caller don't add much value. Remove messages that merely report "out of memory". This preserves some messages that report additional information, e.g., allocation failures that mean we drop hotplug events. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> [bhelgaas: changelog, squash patches, make similar changes to acpiphp, cpqphp, ibmphp, keep warning when dropping hotplug event] Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pci/hotplug/acpiphp_glue.c4
-rw-r--r--drivers/pci/hotplug/cpqphp_core.c1
-rw-r--r--drivers/pci/hotplug/ibmphp_core.c13
-rw-r--r--drivers/pci/hotplug/ibmphp_pci.c60
-rw-r--r--drivers/pci/hotplug/ibmphp_res.c38
-rw-r--r--drivers/pci/hotplug/pciehp_hpc.c5
-rw-r--r--drivers/pci/hotplug/pnv_php.c3
-rw-r--r--drivers/pci/hotplug/shpchp_core.c5
-rw-r--r--drivers/pci/setup-bus.c4
9 files changed, 42 insertions, 91 deletions
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index 5db6f1839dad..96f5b986454a 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -811,10 +811,8 @@ void acpiphp_enumerate_slots(struct pci_bus *bus)
811 811
812 handle = adev->handle; 812 handle = adev->handle;
813 bridge = kzalloc(sizeof(struct acpiphp_bridge), GFP_KERNEL); 813 bridge = kzalloc(sizeof(struct acpiphp_bridge), GFP_KERNEL);
814 if (!bridge) { 814 if (!bridge)
815 acpi_handle_err(handle, "No memory for bridge object\n");
816 return; 815 return;
817 }
818 816
819 INIT_LIST_HEAD(&bridge->slots); 817 INIT_LIST_HEAD(&bridge->slots);
820 kref_init(&bridge->ref); 818 kref_init(&bridge->ref);
diff --git a/drivers/pci/hotplug/cpqphp_core.c b/drivers/pci/hotplug/cpqphp_core.c
index 70967ac75265..d28992788eaa 100644
--- a/drivers/pci/hotplug/cpqphp_core.c
+++ b/drivers/pci/hotplug/cpqphp_core.c
@@ -883,7 +883,6 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
883 883
884 ctrl = kzalloc(sizeof(struct controller), GFP_KERNEL); 884 ctrl = kzalloc(sizeof(struct controller), GFP_KERNEL);
885 if (!ctrl) { 885 if (!ctrl) {
886 err("%s : out of memory\n", __func__);
887 rc = -ENOMEM; 886 rc = -ENOMEM;
888 goto err_disable_device; 887 goto err_disable_device;
889 } 888 }
diff --git a/drivers/pci/hotplug/ibmphp_core.c b/drivers/pci/hotplug/ibmphp_core.c
index 73cf84645c82..4f5c0b936797 100644
--- a/drivers/pci/hotplug/ibmphp_core.c
+++ b/drivers/pci/hotplug/ibmphp_core.c
@@ -603,10 +603,8 @@ int ibmphp_update_slot_info(struct slot *slot_cur)
603 u8 mode; 603 u8 mode;
604 604
605 info = kmalloc(sizeof(struct hotplug_slot_info), GFP_KERNEL); 605 info = kmalloc(sizeof(struct hotplug_slot_info), GFP_KERNEL);
606 if (!info) { 606 if (!info)
607 err("out of system memory\n");
608 return -ENOMEM; 607 return -ENOMEM;
609 }
610 608
611 info->power_status = SLOT_PWRGD(slot_cur->status); 609 info->power_status = SLOT_PWRGD(slot_cur->status);
612 info->attention_status = SLOT_ATTN(slot_cur->status, 610 info->attention_status = SLOT_ATTN(slot_cur->status,
@@ -734,14 +732,12 @@ static u8 bus_structure_fixup(u8 busno)
734 return 1; 732 return 1;
735 733
736 bus = kmalloc(sizeof(*bus), GFP_KERNEL); 734 bus = kmalloc(sizeof(*bus), GFP_KERNEL);
737 if (!bus) { 735 if (!bus)
738 err("%s - out of memory\n", __func__);
739 return 1; 736 return 1;
740 } 737
741 dev = kmalloc(sizeof(*dev), GFP_KERNEL); 738 dev = kmalloc(sizeof(*dev), GFP_KERNEL);
742 if (!dev) { 739 if (!dev) {
743 kfree(bus); 740 kfree(bus);
744 err("%s - out of memory\n", __func__);
745 return 1; 741 return 1;
746 } 742 }
747 743
@@ -1101,7 +1097,6 @@ static int enable_slot(struct hotplug_slot *hs)
1101 if (!slot_cur->func) { 1097 if (!slot_cur->func) {
1102 /* We cannot do update_slot_info here, since no memory for 1098 /* We cannot do update_slot_info here, since no memory for
1103 * kmalloc n.e.ways, and update_slot_info allocates some */ 1099 * kmalloc n.e.ways, and update_slot_info allocates some */
1104 err("out of system memory\n");
1105 rc = -ENOMEM; 1100 rc = -ENOMEM;
1106 goto error_power; 1101 goto error_power;
1107 } 1102 }
@@ -1208,7 +1203,6 @@ int ibmphp_do_disable_slot(struct slot *slot_cur)
1208 /* We need this for functions that were there on bootup */ 1203 /* We need this for functions that were there on bootup */
1209 slot_cur->func = kzalloc(sizeof(struct pci_func), GFP_KERNEL); 1204 slot_cur->func = kzalloc(sizeof(struct pci_func), GFP_KERNEL);
1210 if (!slot_cur->func) { 1205 if (!slot_cur->func) {
1211 err("out of system memory\n");
1212 rc = -ENOMEM; 1206 rc = -ENOMEM;
1213 goto error; 1207 goto error;
1214 } 1208 }
@@ -1306,7 +1300,6 @@ static int __init ibmphp_init(void)
1306 1300
1307 ibmphp_pci_bus = kmalloc(sizeof(*ibmphp_pci_bus), GFP_KERNEL); 1301 ibmphp_pci_bus = kmalloc(sizeof(*ibmphp_pci_bus), GFP_KERNEL);
1308 if (!ibmphp_pci_bus) { 1302 if (!ibmphp_pci_bus) {
1309 err("out of memory\n");
1310 rc = -ENOMEM; 1303 rc = -ENOMEM;
1311 goto exit; 1304 goto exit;
1312 } 1305 }
diff --git a/drivers/pci/hotplug/ibmphp_pci.c b/drivers/pci/hotplug/ibmphp_pci.c
index 25edd0b18b75..c7ce7d8cf998 100644
--- a/drivers/pci/hotplug/ibmphp_pci.c
+++ b/drivers/pci/hotplug/ibmphp_pci.c
@@ -167,10 +167,9 @@ int ibmphp_configure_card(struct pci_func *func, u8 slotno)
167 goto error; 167 goto error;
168 } 168 }
169 newfunc = kzalloc(sizeof(*newfunc), GFP_KERNEL); 169 newfunc = kzalloc(sizeof(*newfunc), GFP_KERNEL);
170 if (!newfunc) { 170 if (!newfunc)
171 err("out of system memory\n");
172 return -ENOMEM; 171 return -ENOMEM;
173 } 172
174 newfunc->busno = cur_func->busno; 173 newfunc->busno = cur_func->busno;
175 newfunc->device = device; 174 newfunc->device = device;
176 cur_func->next = newfunc; 175 cur_func->next = newfunc;
@@ -205,10 +204,9 @@ int ibmphp_configure_card(struct pci_func *func, u8 slotno)
205 for (i = 0; i < 32; i++) { 204 for (i = 0; i < 32; i++) {
206 if (func->devices[i]) { 205 if (func->devices[i]) {
207 newfunc = kzalloc(sizeof(*newfunc), GFP_KERNEL); 206 newfunc = kzalloc(sizeof(*newfunc), GFP_KERNEL);
208 if (!newfunc) { 207 if (!newfunc)
209 err("out of system memory\n");
210 return -ENOMEM; 208 return -ENOMEM;
211 } 209
212 newfunc->busno = sec_number; 210 newfunc->busno = sec_number;
213 newfunc->device = (u8) i; 211 newfunc->device = (u8) i;
214 for (j = 0; j < 4; j++) 212 for (j = 0; j < 4; j++)
@@ -233,10 +231,9 @@ int ibmphp_configure_card(struct pci_func *func, u8 slotno)
233 } 231 }
234 232
235 newfunc = kzalloc(sizeof(*newfunc), GFP_KERNEL); 233 newfunc = kzalloc(sizeof(*newfunc), GFP_KERNEL);
236 if (!newfunc) { 234 if (!newfunc)
237 err("out of system memory\n");
238 return -ENOMEM; 235 return -ENOMEM;
239 } 236
240 newfunc->busno = cur_func->busno; 237 newfunc->busno = cur_func->busno;
241 newfunc->device = device; 238 newfunc->device = device;
242 for (j = 0; j < 4; j++) 239 for (j = 0; j < 4; j++)
@@ -279,10 +276,9 @@ int ibmphp_configure_card(struct pci_func *func, u8 slotno)
279 if (func->devices[i]) { 276 if (func->devices[i]) {
280 debug("inside for loop, device is %x\n", i); 277 debug("inside for loop, device is %x\n", i);
281 newfunc = kzalloc(sizeof(*newfunc), GFP_KERNEL); 278 newfunc = kzalloc(sizeof(*newfunc), GFP_KERNEL);
282 if (!newfunc) { 279 if (!newfunc)
283 err(" out of system memory\n");
284 return -ENOMEM; 280 return -ENOMEM;
285 } 281
286 newfunc->busno = sec_number; 282 newfunc->busno = sec_number;
287 newfunc->device = (u8) i; 283 newfunc->device = (u8) i;
288 for (j = 0; j < 4; j++) 284 for (j = 0; j < 4; j++)
@@ -405,10 +401,9 @@ static int configure_device(struct pci_func *func)
405 401
406 io[count] = kzalloc(sizeof(struct resource_node), GFP_KERNEL); 402 io[count] = kzalloc(sizeof(struct resource_node), GFP_KERNEL);
407 403
408 if (!io[count]) { 404 if (!io[count])
409 err("out of system memory\n");
410 return -ENOMEM; 405 return -ENOMEM;
411 } 406
412 io[count]->type = IO; 407 io[count]->type = IO;
413 io[count]->busno = func->busno; 408 io[count]->busno = func->busno;
414 io[count]->devfunc = PCI_DEVFN(func->device, func->function); 409 io[count]->devfunc = PCI_DEVFN(func->device, func->function);
@@ -442,10 +437,9 @@ static int configure_device(struct pci_func *func)
442 debug("len[count] in PFMEM %x, count %d\n", len[count], count); 437 debug("len[count] in PFMEM %x, count %d\n", len[count], count);
443 438
444 pfmem[count] = kzalloc(sizeof(struct resource_node), GFP_KERNEL); 439 pfmem[count] = kzalloc(sizeof(struct resource_node), GFP_KERNEL);
445 if (!pfmem[count]) { 440 if (!pfmem[count])
446 err("out of system memory\n");
447 return -ENOMEM; 441 return -ENOMEM;
448 } 442
449 pfmem[count]->type = PFMEM; 443 pfmem[count]->type = PFMEM;
450 pfmem[count]->busno = func->busno; 444 pfmem[count]->busno = func->busno;
451 pfmem[count]->devfunc = PCI_DEVFN(func->device, 445 pfmem[count]->devfunc = PCI_DEVFN(func->device,
@@ -458,7 +452,6 @@ static int configure_device(struct pci_func *func)
458 } else { 452 } else {
459 mem_tmp = kzalloc(sizeof(*mem_tmp), GFP_KERNEL); 453 mem_tmp = kzalloc(sizeof(*mem_tmp), GFP_KERNEL);
460 if (!mem_tmp) { 454 if (!mem_tmp) {
461 err("out of system memory\n");
462 kfree(pfmem[count]); 455 kfree(pfmem[count]);
463 return -ENOMEM; 456 return -ENOMEM;
464 } 457 }
@@ -508,10 +501,9 @@ static int configure_device(struct pci_func *func)
508 debug("len[count] in Mem %x, count %d\n", len[count], count); 501 debug("len[count] in Mem %x, count %d\n", len[count], count);
509 502
510 mem[count] = kzalloc(sizeof(struct resource_node), GFP_KERNEL); 503 mem[count] = kzalloc(sizeof(struct resource_node), GFP_KERNEL);
511 if (!mem[count]) { 504 if (!mem[count])
512 err("out of system memory\n");
513 return -ENOMEM; 505 return -ENOMEM;
514 } 506
515 mem[count]->type = MEM; 507 mem[count]->type = MEM;
516 mem[count]->busno = func->busno; 508 mem[count]->busno = func->busno;
517 mem[count]->devfunc = PCI_DEVFN(func->device, 509 mem[count]->devfunc = PCI_DEVFN(func->device,
@@ -674,7 +666,6 @@ static int configure_bridge(struct pci_func **func_passed, u8 slotno)
674 bus_io[count] = kzalloc(sizeof(struct resource_node), GFP_KERNEL); 666 bus_io[count] = kzalloc(sizeof(struct resource_node), GFP_KERNEL);
675 667
676 if (!bus_io[count]) { 668 if (!bus_io[count]) {
677 err("out of system memory\n");
678 retval = -ENOMEM; 669 retval = -ENOMEM;
679 goto error; 670 goto error;
680 } 671 }
@@ -706,7 +697,6 @@ static int configure_bridge(struct pci_func **func_passed, u8 slotno)
706 697
707 bus_pfmem[count] = kzalloc(sizeof(struct resource_node), GFP_KERNEL); 698 bus_pfmem[count] = kzalloc(sizeof(struct resource_node), GFP_KERNEL);
708 if (!bus_pfmem[count]) { 699 if (!bus_pfmem[count]) {
709 err("out of system memory\n");
710 retval = -ENOMEM; 700 retval = -ENOMEM;
711 goto error; 701 goto error;
712 } 702 }
@@ -722,7 +712,6 @@ static int configure_bridge(struct pci_func **func_passed, u8 slotno)
722 } else { 712 } else {
723 mem_tmp = kzalloc(sizeof(*mem_tmp), GFP_KERNEL); 713 mem_tmp = kzalloc(sizeof(*mem_tmp), GFP_KERNEL);
724 if (!mem_tmp) { 714 if (!mem_tmp) {
725 err("out of system memory\n");
726 retval = -ENOMEM; 715 retval = -ENOMEM;
727 goto error; 716 goto error;
728 } 717 }
@@ -763,7 +752,6 @@ static int configure_bridge(struct pci_func **func_passed, u8 slotno)
763 752
764 bus_mem[count] = kzalloc(sizeof(struct resource_node), GFP_KERNEL); 753 bus_mem[count] = kzalloc(sizeof(struct resource_node), GFP_KERNEL);
765 if (!bus_mem[count]) { 754 if (!bus_mem[count]) {
766 err("out of system memory\n");
767 retval = -ENOMEM; 755 retval = -ENOMEM;
768 goto error; 756 goto error;
769 } 757 }
@@ -834,7 +822,6 @@ static int configure_bridge(struct pci_func **func_passed, u8 slotno)
834 io = kzalloc(sizeof(*io), GFP_KERNEL); 822 io = kzalloc(sizeof(*io), GFP_KERNEL);
835 823
836 if (!io) { 824 if (!io) {
837 err("out of system memory\n");
838 retval = -ENOMEM; 825 retval = -ENOMEM;
839 goto error; 826 goto error;
840 } 827 }
@@ -856,7 +843,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); 843 debug("it wants %x memory behind the bridge\n", amount_needed->mem);
857 mem = kzalloc(sizeof(*mem), GFP_KERNEL); 844 mem = kzalloc(sizeof(*mem), GFP_KERNEL);
858 if (!mem) { 845 if (!mem) {
859 err("out of system memory\n");
860 retval = -ENOMEM; 846 retval = -ENOMEM;
861 goto error; 847 goto error;
862 } 848 }
@@ -878,7 +864,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); 864 debug("it wants %x pfmemory behind the bridge\n", amount_needed->pfmem);
879 pfmem = kzalloc(sizeof(*pfmem), GFP_KERNEL); 865 pfmem = kzalloc(sizeof(*pfmem), GFP_KERNEL);
880 if (!pfmem) { 866 if (!pfmem) {
881 err("out of system memory\n");
882 retval = -ENOMEM; 867 retval = -ENOMEM;
883 goto error; 868 goto error;
884 } 869 }
@@ -893,7 +878,6 @@ static int configure_bridge(struct pci_func **func_passed, u8 slotno)
893 } else { 878 } else {
894 mem_tmp = kzalloc(sizeof(*mem_tmp), GFP_KERNEL); 879 mem_tmp = kzalloc(sizeof(*mem_tmp), GFP_KERNEL);
895 if (!mem_tmp) { 880 if (!mem_tmp) {
896 err("out of system memory\n");
897 retval = -ENOMEM; 881 retval = -ENOMEM;
898 goto error; 882 goto error;
899 } 883 }
@@ -924,7 +908,6 @@ static int configure_bridge(struct pci_func **func_passed, u8 slotno)
924 if (!bus) { 908 if (!bus) {
925 bus = kzalloc(sizeof(*bus), GFP_KERNEL); 909 bus = kzalloc(sizeof(*bus), GFP_KERNEL);
926 if (!bus) { 910 if (!bus) {
927 err("out of system memory\n");
928 retval = -ENOMEM; 911 retval = -ENOMEM;
929 goto error; 912 goto error;
930 } 913 }
@@ -1652,10 +1635,9 @@ static int add_new_bus(struct bus_node *bus, struct resource_node *io, struct re
1652 } 1635 }
1653 if (io) { 1636 if (io) {
1654 io_range = kzalloc(sizeof(*io_range), GFP_KERNEL); 1637 io_range = kzalloc(sizeof(*io_range), GFP_KERNEL);
1655 if (!io_range) { 1638 if (!io_range)
1656 err("out of system memory\n");
1657 return -ENOMEM; 1639 return -ENOMEM;
1658 } 1640
1659 io_range->start = io->start; 1641 io_range->start = io->start;
1660 io_range->end = io->end; 1642 io_range->end = io->end;
1661 io_range->rangeno = 1; 1643 io_range->rangeno = 1;
@@ -1664,10 +1646,9 @@ static int add_new_bus(struct bus_node *bus, struct resource_node *io, struct re
1664 } 1646 }
1665 if (mem) { 1647 if (mem) {
1666 mem_range = kzalloc(sizeof(*mem_range), GFP_KERNEL); 1648 mem_range = kzalloc(sizeof(*mem_range), GFP_KERNEL);
1667 if (!mem_range) { 1649 if (!mem_range)
1668 err("out of system memory\n");
1669 return -ENOMEM; 1650 return -ENOMEM;
1670 } 1651
1671 mem_range->start = mem->start; 1652 mem_range->start = mem->start;
1672 mem_range->end = mem->end; 1653 mem_range->end = mem->end;
1673 mem_range->rangeno = 1; 1654 mem_range->rangeno = 1;
@@ -1676,10 +1657,9 @@ static int add_new_bus(struct bus_node *bus, struct resource_node *io, struct re
1676 } 1657 }
1677 if (pfmem) { 1658 if (pfmem) {
1678 pfmem_range = kzalloc(sizeof(*pfmem_range), GFP_KERNEL); 1659 pfmem_range = kzalloc(sizeof(*pfmem_range), GFP_KERNEL);
1679 if (!pfmem_range) { 1660 if (!pfmem_range)
1680 err("out of system memory\n");
1681 return -ENOMEM; 1661 return -ENOMEM;
1682 } 1662
1683 pfmem_range->start = pfmem->start; 1663 pfmem_range->start = pfmem->start;
1684 pfmem_range->end = pfmem->end; 1664 pfmem_range->end = pfmem->end;
1685 pfmem_range->rangeno = 1; 1665 pfmem_range->rangeno = 1;
diff --git a/drivers/pci/hotplug/ibmphp_res.c b/drivers/pci/hotplug/ibmphp_res.c
index aee6e41001e1..b58a7a641e0e 100644
--- a/drivers/pci/hotplug/ibmphp_res.c
+++ b/drivers/pci/hotplug/ibmphp_res.c
@@ -56,10 +56,8 @@ static struct bus_node * __init alloc_error_bus(struct ebda_pci_rsrc *curr, u8 b
56 } 56 }
57 57
58 newbus = kzalloc(sizeof(struct bus_node), GFP_KERNEL); 58 newbus = kzalloc(sizeof(struct bus_node), GFP_KERNEL);
59 if (!newbus) { 59 if (!newbus)
60 err("out of system memory\n");
61 return NULL; 60 return NULL;
62 }
63 61
64 if (flag) 62 if (flag)
65 newbus->busno = busno; 63 newbus->busno = busno;
@@ -79,10 +77,9 @@ static struct resource_node * __init alloc_resources(struct ebda_pci_rsrc *curr)
79 } 77 }
80 78
81 rs = kzalloc(sizeof(struct resource_node), GFP_KERNEL); 79 rs = kzalloc(sizeof(struct resource_node), GFP_KERNEL);
82 if (!rs) { 80 if (!rs)
83 err("out of system memory\n");
84 return NULL; 81 return NULL;
85 } 82
86 rs->busno = curr->bus_num; 83 rs->busno = curr->bus_num;
87 rs->devfunc = curr->dev_fun; 84 rs->devfunc = curr->dev_fun;
88 rs->start = curr->start_addr; 85 rs->start = curr->start_addr;
@@ -99,10 +96,9 @@ static int __init alloc_bus_range(struct bus_node **new_bus, struct range_node *
99 96
100 if (first_bus) { 97 if (first_bus) {
101 newbus = kzalloc(sizeof(struct bus_node), GFP_KERNEL); 98 newbus = kzalloc(sizeof(struct bus_node), GFP_KERNEL);
102 if (!newbus) { 99 if (!newbus)
103 err("out of system memory.\n");
104 return -ENOMEM; 100 return -ENOMEM;
105 } 101
106 newbus->busno = curr->bus_num; 102 newbus->busno = curr->bus_num;
107 } else { 103 } else {
108 newbus = *new_bus; 104 newbus = *new_bus;
@@ -123,7 +119,6 @@ static int __init alloc_bus_range(struct bus_node **new_bus, struct range_node *
123 if (!newrange) { 119 if (!newrange) {
124 if (first_bus) 120 if (first_bus)
125 kfree(newbus); 121 kfree(newbus);
126 err("out of system memory\n");
127 return -ENOMEM; 122 return -ENOMEM;
128 } 123 }
129 newrange->start = curr->start_addr; 124 newrange->start = curr->start_addr;
@@ -1707,10 +1702,9 @@ static int __init once_over(void)
1707 bus_cur->firstPFMemFromMem = pfmem_cur; 1702 bus_cur->firstPFMemFromMem = pfmem_cur;
1708 1703
1709 mem = kzalloc(sizeof(struct resource_node), GFP_KERNEL); 1704 mem = kzalloc(sizeof(struct resource_node), GFP_KERNEL);
1710 if (!mem) { 1705 if (!mem)
1711 err("out of system memory\n");
1712 return -ENOMEM; 1706 return -ENOMEM;
1713 } 1707
1714 mem->type = MEM; 1708 mem->type = MEM;
1715 mem->busno = pfmem_cur->busno; 1709 mem->busno = pfmem_cur->busno;
1716 mem->devfunc = pfmem_cur->devfunc; 1710 mem->devfunc = pfmem_cur->devfunc;
@@ -1989,10 +1983,9 @@ static int __init update_bridge_ranges(struct bus_node **bus)
1989 1983
1990 if ((start_address) && (start_address <= end_address)) { 1984 if ((start_address) && (start_address <= end_address)) {
1991 range = kzalloc(sizeof(struct range_node), GFP_KERNEL); 1985 range = kzalloc(sizeof(struct range_node), GFP_KERNEL);
1992 if (!range) { 1986 if (!range)
1993 err("out of system memory\n");
1994 return -ENOMEM; 1987 return -ENOMEM;
1995 } 1988
1996 range->start = start_address; 1989 range->start = start_address;
1997 range->end = end_address + 0xfff; 1990 range->end = end_address + 0xfff;
1998 1991
@@ -2016,7 +2009,6 @@ static int __init update_bridge_ranges(struct bus_node **bus)
2016 io = kzalloc(sizeof(struct resource_node), GFP_KERNEL); 2009 io = kzalloc(sizeof(struct resource_node), GFP_KERNEL);
2017 if (!io) { 2010 if (!io) {
2018 kfree(range); 2011 kfree(range);
2019 err("out of system memory\n");
2020 return -ENOMEM; 2012 return -ENOMEM;
2021 } 2013 }
2022 io->type = IO; 2014 io->type = IO;
@@ -2038,10 +2030,9 @@ static int __init update_bridge_ranges(struct bus_node **bus)
2038 if ((start_address) && (start_address <= end_address)) { 2030 if ((start_address) && (start_address <= end_address)) {
2039 2031
2040 range = kzalloc(sizeof(struct range_node), GFP_KERNEL); 2032 range = kzalloc(sizeof(struct range_node), GFP_KERNEL);
2041 if (!range) { 2033 if (!range)
2042 err("out of system memory\n");
2043 return -ENOMEM; 2034 return -ENOMEM;
2044 } 2035
2045 range->start = start_address; 2036 range->start = start_address;
2046 range->end = end_address + 0xfffff; 2037 range->end = end_address + 0xfffff;
2047 2038
@@ -2066,7 +2057,6 @@ static int __init update_bridge_ranges(struct bus_node **bus)
2066 mem = kzalloc(sizeof(struct resource_node), GFP_KERNEL); 2057 mem = kzalloc(sizeof(struct resource_node), GFP_KERNEL);
2067 if (!mem) { 2058 if (!mem) {
2068 kfree(range); 2059 kfree(range);
2069 err("out of system memory\n");
2070 return -ENOMEM; 2060 return -ENOMEM;
2071 } 2061 }
2072 mem->type = MEM; 2062 mem->type = MEM;
@@ -2092,10 +2082,9 @@ static int __init update_bridge_ranges(struct bus_node **bus)
2092 if ((start_address) && (start_address <= end_address)) { 2082 if ((start_address) && (start_address <= end_address)) {
2093 2083
2094 range = kzalloc(sizeof(struct range_node), GFP_KERNEL); 2084 range = kzalloc(sizeof(struct range_node), GFP_KERNEL);
2095 if (!range) { 2085 if (!range)
2096 err("out of system memory\n");
2097 return -ENOMEM; 2086 return -ENOMEM;
2098 } 2087
2099 range->start = start_address; 2088 range->start = start_address;
2100 range->end = end_address + 0xfffff; 2089 range->end = end_address + 0xfffff;
2101 2090
@@ -2119,7 +2108,6 @@ static int __init update_bridge_ranges(struct bus_node **bus)
2119 pfmem = kzalloc(sizeof(struct resource_node), GFP_KERNEL); 2108 pfmem = kzalloc(sizeof(struct resource_node), GFP_KERNEL);
2120 if (!pfmem) { 2109 if (!pfmem) {
2121 kfree(range); 2110 kfree(range);
2122 err("out of system memory\n");
2123 return -ENOMEM; 2111 return -ENOMEM;
2124 } 2112 }
2125 pfmem->type = PFMEM; 2113 pfmem->type = PFMEM;
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
index 7bab0606f1a9..ed27635ec740 100644
--- a/drivers/pci/hotplug/pciehp_hpc.c
+++ b/drivers/pci/hotplug/pciehp_hpc.c
@@ -838,10 +838,9 @@ struct controller *pcie_init(struct pcie_device *dev)
838 struct pci_dev *pdev = dev->port; 838 struct pci_dev *pdev = dev->port;
839 839
840 ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL); 840 ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL);
841 if (!ctrl) { 841 if (!ctrl)
842 dev_err(&dev->device, "%s: Out of memory\n", __func__);
843 goto abort; 842 goto abort;
844 } 843
845 ctrl->pcie = dev; 844 ctrl->pcie = dev;
846 pcie_capability_read_dword(pdev, PCI_EXP_SLTCAP, &slot_cap); 845 pcie_capability_read_dword(pdev, PCI_EXP_SLTCAP, &slot_cap);
847 846
diff --git a/drivers/pci/hotplug/pnv_php.c b/drivers/pci/hotplug/pnv_php.c
index 74f6a17e4614..318baa507364 100644
--- a/drivers/pci/hotplug/pnv_php.c
+++ b/drivers/pci/hotplug/pnv_php.c
@@ -266,7 +266,6 @@ static int pnv_php_add_devtree(struct pnv_php_slot *php_slot)
266 fdt1 = kzalloc(0x10000, GFP_KERNEL); 266 fdt1 = kzalloc(0x10000, GFP_KERNEL);
267 if (!fdt1) { 267 if (!fdt1) {
268 ret = -ENOMEM; 268 ret = -ENOMEM;
269 dev_warn(&php_slot->pdev->dev, "Cannot alloc FDT blob\n");
270 goto out; 269 goto out;
271 } 270 }
272 271
@@ -280,8 +279,6 @@ static int pnv_php_add_devtree(struct pnv_php_slot *php_slot)
280 fdt = kzalloc(fdt_totalsize(fdt1), GFP_KERNEL); 279 fdt = kzalloc(fdt_totalsize(fdt1), GFP_KERNEL);
281 if (!fdt) { 280 if (!fdt) {
282 ret = -ENOMEM; 281 ret = -ENOMEM;
283 dev_warn(&php_slot->pdev->dev, "Cannot %d bytes memory\n",
284 fdt_totalsize(fdt1));
285 goto free_fdt1; 282 goto free_fdt1;
286 } 283 }
287 284
diff --git a/drivers/pci/hotplug/shpchp_core.c b/drivers/pci/hotplug/shpchp_core.c
index 7bfb87bd2b7e..2f2b87acf179 100644
--- a/drivers/pci/hotplug/shpchp_core.c
+++ b/drivers/pci/hotplug/shpchp_core.c
@@ -305,10 +305,9 @@ static int shpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
305 return -ENODEV; 305 return -ENODEV;
306 306
307 ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL); 307 ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL);
308 if (!ctrl) { 308 if (!ctrl)
309 dev_err(&pdev->dev, "%s: Out of memory\n", __func__);
310 goto err_out_none; 309 goto err_out_none;
311 } 310
312 INIT_LIST_HEAD(&ctrl->slot_list); 311 INIT_LIST_HEAD(&ctrl->slot_list);
313 312
314 rc = shpc_init(ctrl, pdev); 313 rc = shpc_init(ctrl, pdev);
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index b1ad466199ad..d131d29c4fdb 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -67,10 +67,8 @@ static int add_to_list(struct list_head *head,
67 struct pci_dev_resource *tmp; 67 struct pci_dev_resource *tmp;
68 68
69 tmp = kzalloc(sizeof(*tmp), GFP_KERNEL); 69 tmp = kzalloc(sizeof(*tmp), GFP_KERNEL);
70 if (!tmp) { 70 if (!tmp)
71 pr_warn("add_to_list: kmalloc() failed!\n");
72 return -ENOMEM; 71 return -ENOMEM;
73 }
74 72
75 tmp->res = res; 73 tmp->res = res;
76 tmp->dev = dev; 74 tmp->dev = dev;