aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/hotplug/ibmphp_res.c
diff options
context:
space:
mode:
authorEric Sesterhenn <snakebyte@gmx.de>2006-02-28 09:34:49 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2006-03-23 17:35:17 -0500
commitf5afe8064f3087bead8fea7e32547c2a3ada5fd0 (patch)
treede6a9d60aad6ee262c04290d73e414cd92b4ad5d /drivers/pci/hotplug/ibmphp_res.c
parent7c8f25da12a3dda46fb730699582895d5fc51287 (diff)
[PATCH] PCI: kzalloc() conversion in drivers/pci
this patch converts drivers/pci to kzalloc usage. Compile tested with allyes config. Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/pci/hotplug/ibmphp_res.c')
-rw-r--r--drivers/pci/hotplug/ibmphp_res.c33
1 files changed, 11 insertions, 22 deletions
diff --git a/drivers/pci/hotplug/ibmphp_res.c b/drivers/pci/hotplug/ibmphp_res.c
index 9c224c94d698..852a98bf07d3 100644
--- a/drivers/pci/hotplug/ibmphp_res.c
+++ b/drivers/pci/hotplug/ibmphp_res.c
@@ -55,13 +55,12 @@ static struct bus_node * __init alloc_error_bus (struct ebda_pci_rsrc * curr, u8
55 return NULL; 55 return NULL;
56 } 56 }
57 57
58 newbus = kmalloc (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"); 60 err ("out of system memory\n");
61 return NULL; 61 return NULL;
62 } 62 }
63 63
64 memset (newbus, 0, sizeof (struct bus_node));
65 if (flag) 64 if (flag)
66 newbus->busno = busno; 65 newbus->busno = busno;
67 else 66 else
@@ -79,12 +78,11 @@ static struct resource_node * __init alloc_resources (struct ebda_pci_rsrc * cur
79 return NULL; 78 return NULL;
80 } 79 }
81 80
82 rs = kmalloc (sizeof (struct resource_node), GFP_KERNEL); 81 rs = kzalloc(sizeof(struct resource_node), GFP_KERNEL);
83 if (!rs) { 82 if (!rs) {
84 err ("out of system memory\n"); 83 err ("out of system memory\n");
85 return NULL; 84 return NULL;
86 } 85 }
87 memset (rs, 0, sizeof (struct resource_node));
88 rs->busno = curr->bus_num; 86 rs->busno = curr->bus_num;
89 rs->devfunc = curr->dev_fun; 87 rs->devfunc = curr->dev_fun;
90 rs->start = curr->start_addr; 88 rs->start = curr->start_addr;
@@ -100,12 +98,11 @@ static int __init alloc_bus_range (struct bus_node **new_bus, struct range_node
100 u8 num_ranges = 0; 98 u8 num_ranges = 0;
101 99
102 if (first_bus) { 100 if (first_bus) {
103 newbus = kmalloc (sizeof (struct bus_node), GFP_KERNEL); 101 newbus = kzalloc(sizeof(struct bus_node), GFP_KERNEL);
104 if (!newbus) { 102 if (!newbus) {
105 err ("out of system memory.\n"); 103 err ("out of system memory.\n");
106 return -ENOMEM; 104 return -ENOMEM;
107 } 105 }
108 memset (newbus, 0, sizeof (struct bus_node));
109 newbus->busno = curr->bus_num; 106 newbus->busno = curr->bus_num;
110 } else { 107 } else {
111 newbus = *new_bus; 108 newbus = *new_bus;
@@ -122,14 +119,13 @@ static int __init alloc_bus_range (struct bus_node **new_bus, struct range_node
122 } 119 }
123 } 120 }
124 121
125 newrange = kmalloc (sizeof (struct range_node), GFP_KERNEL); 122 newrange = kzalloc(sizeof(struct range_node), GFP_KERNEL);
126 if (!newrange) { 123 if (!newrange) {
127 if (first_bus) 124 if (first_bus)
128 kfree (newbus); 125 kfree (newbus);
129 err ("out of system memory\n"); 126 err ("out of system memory\n");
130 return -ENOMEM; 127 return -ENOMEM;
131 } 128 }
132 memset (newrange, 0, sizeof (struct range_node));
133 newrange->start = curr->start_addr; 129 newrange->start = curr->start_addr;
134 newrange->end = curr->end_addr; 130 newrange->end = curr->end_addr;
135 131
@@ -1705,12 +1701,11 @@ static int __init once_over (void)
1705 1701
1706 bus_cur->firstPFMemFromMem = pfmem_cur; 1702 bus_cur->firstPFMemFromMem = pfmem_cur;
1707 1703
1708 mem = kmalloc (sizeof (struct resource_node), GFP_KERNEL); 1704 mem = kzalloc(sizeof(struct resource_node), GFP_KERNEL);
1709 if (!mem) { 1705 if (!mem) {
1710 err ("out of system memory\n"); 1706 err ("out of system memory\n");
1711 return -ENOMEM; 1707 return -ENOMEM;
1712 } 1708 }
1713 memset (mem, 0, sizeof (struct resource_node));
1714 mem->type = MEM; 1709 mem->type = MEM;
1715 mem->busno = pfmem_cur->busno; 1710 mem->busno = pfmem_cur->busno;
1716 mem->devfunc = pfmem_cur->devfunc; 1711 mem->devfunc = pfmem_cur->devfunc;
@@ -1994,12 +1989,11 @@ static int __init update_bridge_ranges (struct bus_node **bus)
1994 end_address |= (upper_io_end << 16); 1989 end_address |= (upper_io_end << 16);
1995 1990
1996 if ((start_address) && (start_address <= end_address)) { 1991 if ((start_address) && (start_address <= end_address)) {
1997 range = kmalloc (sizeof (struct range_node), GFP_KERNEL); 1992 range = kzalloc(sizeof(struct range_node), GFP_KERNEL);
1998 if (!range) { 1993 if (!range) {
1999 err ("out of system memory\n"); 1994 err ("out of system memory\n");
2000 return -ENOMEM; 1995 return -ENOMEM;
2001 } 1996 }
2002 memset (range, 0, sizeof (struct range_node));
2003 range->start = start_address; 1997 range->start = start_address;
2004 range->end = end_address + 0xfff; 1998 range->end = end_address + 0xfff;
2005 1999
@@ -2020,13 +2014,12 @@ static int __init update_bridge_ranges (struct bus_node **bus)
2020 fix_resources (bus_sec); 2014 fix_resources (bus_sec);
2021 2015
2022 if (ibmphp_find_resource (bus_cur, start_address, &io, IO)) { 2016 if (ibmphp_find_resource (bus_cur, start_address, &io, IO)) {
2023 io = kmalloc (sizeof (struct resource_node), GFP_KERNEL); 2017 io = kzalloc(sizeof(struct resource_node), GFP_KERNEL);
2024 if (!io) { 2018 if (!io) {
2025 kfree (range); 2019 kfree (range);
2026 err ("out of system memory\n"); 2020 err ("out of system memory\n");
2027 return -ENOMEM; 2021 return -ENOMEM;
2028 } 2022 }
2029 memset (io, 0, sizeof (struct resource_node));
2030 io->type = IO; 2023 io->type = IO;
2031 io->busno = bus_cur->busno; 2024 io->busno = bus_cur->busno;
2032 io->devfunc = ((device << 3) | (function & 0x7)); 2025 io->devfunc = ((device << 3) | (function & 0x7));
@@ -2045,12 +2038,11 @@ static int __init update_bridge_ranges (struct bus_node **bus)
2045 2038
2046 if ((start_address) && (start_address <= end_address)) { 2039 if ((start_address) && (start_address <= end_address)) {
2047 2040
2048 range = kmalloc (sizeof (struct range_node), GFP_KERNEL); 2041 range = kzalloc(sizeof(struct range_node), GFP_KERNEL);
2049 if (!range) { 2042 if (!range) {
2050 err ("out of system memory\n"); 2043 err ("out of system memory\n");
2051 return -ENOMEM; 2044 return -ENOMEM;
2052 } 2045 }
2053 memset (range, 0, sizeof (struct range_node));
2054 range->start = start_address; 2046 range->start = start_address;
2055 range->end = end_address + 0xfffff; 2047 range->end = end_address + 0xfffff;
2056 2048
@@ -2072,13 +2064,12 @@ static int __init update_bridge_ranges (struct bus_node **bus)
2072 fix_resources (bus_sec); 2064 fix_resources (bus_sec);
2073 2065
2074 if (ibmphp_find_resource (bus_cur, start_address, &mem, MEM)) { 2066 if (ibmphp_find_resource (bus_cur, start_address, &mem, MEM)) {
2075 mem = kmalloc (sizeof (struct resource_node), GFP_KERNEL); 2067 mem = kzalloc(sizeof(struct resource_node), GFP_KERNEL);
2076 if (!mem) { 2068 if (!mem) {
2077 kfree (range); 2069 kfree (range);
2078 err ("out of system memory\n"); 2070 err ("out of system memory\n");
2079 return -ENOMEM; 2071 return -ENOMEM;
2080 } 2072 }
2081 memset (mem, 0, sizeof (struct resource_node));
2082 mem->type = MEM; 2073 mem->type = MEM;
2083 mem->busno = bus_cur->busno; 2074 mem->busno = bus_cur->busno;
2084 mem->devfunc = ((device << 3) | (function & 0x7)); 2075 mem->devfunc = ((device << 3) | (function & 0x7));
@@ -2101,12 +2092,11 @@ static int __init update_bridge_ranges (struct bus_node **bus)
2101 2092
2102 if ((start_address) && (start_address <= end_address)) { 2093 if ((start_address) && (start_address <= end_address)) {
2103 2094
2104 range = kmalloc (sizeof (struct range_node), GFP_KERNEL); 2095 range = kzalloc(sizeof(struct range_node), GFP_KERNEL);
2105 if (!range) { 2096 if (!range) {
2106 err ("out of system memory\n"); 2097 err ("out of system memory\n");
2107 return -ENOMEM; 2098 return -ENOMEM;
2108 } 2099 }
2109 memset (range, 0, sizeof (struct range_node));
2110 range->start = start_address; 2100 range->start = start_address;
2111 range->end = end_address + 0xfffff; 2101 range->end = end_address + 0xfffff;
2112 2102
@@ -2127,13 +2117,12 @@ static int __init update_bridge_ranges (struct bus_node **bus)
2127 2117
2128 fix_resources (bus_sec); 2118 fix_resources (bus_sec);
2129 if (ibmphp_find_resource (bus_cur, start_address, &pfmem, PFMEM)) { 2119 if (ibmphp_find_resource (bus_cur, start_address, &pfmem, PFMEM)) {
2130 pfmem = kmalloc (sizeof (struct resource_node), GFP_KERNEL); 2120 pfmem = kzalloc(sizeof(struct resource_node), GFP_KERNEL);
2131 if (!pfmem) { 2121 if (!pfmem) {
2132 kfree (range); 2122 kfree (range);
2133 err ("out of system memory\n"); 2123 err ("out of system memory\n");
2134 return -ENOMEM; 2124 return -ENOMEM;
2135 } 2125 }
2136 memset (pfmem, 0, sizeof (struct resource_node));
2137 pfmem->type = PFMEM; 2126 pfmem->type = PFMEM;
2138 pfmem->busno = bus_cur->busno; 2127 pfmem->busno = bus_cur->busno;
2139 pfmem->devfunc = ((device << 3) | (function & 0x7)); 2128 pfmem->devfunc = ((device << 3) | (function & 0x7));