aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pnp/pnpbios/core.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pnp/pnpbios/core.c')
-rw-r--r--drivers/pnp/pnpbios/core.c26
1 files changed, 8 insertions, 18 deletions
diff --git a/drivers/pnp/pnpbios/core.c b/drivers/pnp/pnpbios/core.c
index 778a324028f4..f49674f07949 100644
--- a/drivers/pnp/pnpbios/core.c
+++ b/drivers/pnp/pnpbios/core.c
@@ -86,16 +86,6 @@ int pnp_bios_present(void)
86 86
87struct pnp_dev_node_info node_info; 87struct pnp_dev_node_info node_info;
88 88
89void *pnpbios_kmalloc(size_t size, int f)
90{
91 void *p = kmalloc( size, f );
92 if ( p == NULL )
93 printk(KERN_ERR "PnPBIOS: kmalloc() failed\n");
94 else
95 memset(p, 0, size);
96 return p;
97}
98
99/* 89/*
100 * 90 *
101 * DOCKING FUNCTIONS 91 * DOCKING FUNCTIONS
@@ -121,10 +111,10 @@ static int pnp_dock_event(int dock, struct pnp_docking_station_info *info)
121 if (!current->fs->root) { 111 if (!current->fs->root) {
122 return -EAGAIN; 112 return -EAGAIN;
123 } 113 }
124 if (!(envp = (char **) pnpbios_kmalloc (20 * sizeof (char *), GFP_KERNEL))) { 114 if (!(envp = (char **) kcalloc (20, sizeof (char *), GFP_KERNEL))) {
125 return -ENOMEM; 115 return -ENOMEM;
126 } 116 }
127 if (!(buf = pnpbios_kmalloc (256, GFP_KERNEL))) { 117 if (!(buf = kcalloc (1, 256, GFP_KERNEL))) {
128 kfree (envp); 118 kfree (envp);
129 return -ENOMEM; 119 return -ENOMEM;
130 } 120 }
@@ -231,7 +221,7 @@ static int pnpbios_get_resources(struct pnp_dev * dev, struct pnp_resource_table
231 if(!pnpbios_is_dynamic(dev)) 221 if(!pnpbios_is_dynamic(dev))
232 return -EPERM; 222 return -EPERM;
233 223
234 node = pnpbios_kmalloc(node_info.max_node_size, GFP_KERNEL); 224 node = kcalloc(1, node_info.max_node_size, GFP_KERNEL);
235 if (!node) 225 if (!node)
236 return -1; 226 return -1;
237 if (pnp_bios_get_dev_node(&nodenum, (char )PNPMODE_DYNAMIC, node)) { 227 if (pnp_bios_get_dev_node(&nodenum, (char )PNPMODE_DYNAMIC, node)) {
@@ -254,7 +244,7 @@ static int pnpbios_set_resources(struct pnp_dev * dev, struct pnp_resource_table
254 if (!pnpbios_is_dynamic(dev)) 244 if (!pnpbios_is_dynamic(dev))
255 return -EPERM; 245 return -EPERM;
256 246
257 node = pnpbios_kmalloc(node_info.max_node_size, GFP_KERNEL); 247 node = kcalloc(1, node_info.max_node_size, GFP_KERNEL);
258 if (!node) 248 if (!node)
259 return -1; 249 return -1;
260 if (pnp_bios_get_dev_node(&nodenum, (char )PNPMODE_DYNAMIC, node)) { 250 if (pnp_bios_get_dev_node(&nodenum, (char )PNPMODE_DYNAMIC, node)) {
@@ -305,7 +295,7 @@ static int pnpbios_disable_resources(struct pnp_dev *dev)
305 if(dev->flags & PNPBIOS_NO_DISABLE || !pnpbios_is_dynamic(dev)) 295 if(dev->flags & PNPBIOS_NO_DISABLE || !pnpbios_is_dynamic(dev))
306 return -EPERM; 296 return -EPERM;
307 297
308 node = pnpbios_kmalloc(node_info.max_node_size, GFP_KERNEL); 298 node = kcalloc(1, node_info.max_node_size, GFP_KERNEL);
309 if (!node) 299 if (!node)
310 return -ENOMEM; 300 return -ENOMEM;
311 301
@@ -347,7 +337,7 @@ static int insert_device(struct pnp_dev *dev, struct pnp_bios_node * node)
347 } 337 }
348 338
349 /* set the initial values for the PnP device */ 339 /* set the initial values for the PnP device */
350 dev_id = pnpbios_kmalloc(sizeof(struct pnp_id), GFP_KERNEL); 340 dev_id = kcalloc(1, sizeof(struct pnp_id), GFP_KERNEL);
351 if (!dev_id) 341 if (!dev_id)
352 return -1; 342 return -1;
353 pnpid32_to_pnpid(node->eisa_id,id); 343 pnpid32_to_pnpid(node->eisa_id,id);
@@ -385,7 +375,7 @@ static void __init build_devlist(void)
385 struct pnp_bios_node *node; 375 struct pnp_bios_node *node;
386 struct pnp_dev *dev; 376 struct pnp_dev *dev;
387 377
388 node = pnpbios_kmalloc(node_info.max_node_size, GFP_KERNEL); 378 node = kcalloc(1, node_info.max_node_size, GFP_KERNEL);
389 if (!node) 379 if (!node)
390 return; 380 return;
391 381
@@ -402,7 +392,7 @@ static void __init build_devlist(void)
402 break; 392 break;
403 } 393 }
404 nodes_got++; 394 nodes_got++;
405 dev = pnpbios_kmalloc(sizeof (struct pnp_dev), GFP_KERNEL); 395 dev = kcalloc(1, sizeof (struct pnp_dev), GFP_KERNEL);
406 if (!dev) 396 if (!dev)
407 break; 397 break;
408 if(insert_device(dev,node)<0) 398 if(insert_device(dev,node)<0)