aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorRandy Dunlap <rdunlap@xenotime.net>2005-10-28 23:37:23 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-10-29 14:10:06 -0400
commit57f3bda88a5e5a2810016820a932cb82931dcb1c (patch)
tree38fc121c758d29c686e1d4c436591a8f9d844c06 /drivers/scsi
parentac19bff25b6834d858274406a686f2227dd8489d (diff)
[PATCH] libata-core cleanups (updated)
libata-core cleanups: - use kzalloc() instead of kmalloc() + memset(); - use one exit path in ata_device_add(); Signed-off-by: Randy Dunlap <rdunlap@xenotime.net> Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/libata-core.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index 56c81f0aa1d9..b1b1c6f01419 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -4258,11 +4258,10 @@ int ata_device_add(const struct ata_probe_ent *ent)
4258 4258
4259 DPRINTK("ENTER\n"); 4259 DPRINTK("ENTER\n");
4260 /* alloc a container for our list of ATA ports (buses) */ 4260 /* alloc a container for our list of ATA ports (buses) */
4261 host_set = kmalloc(sizeof(struct ata_host_set) + 4261 host_set = kzalloc(sizeof(struct ata_host_set) +
4262 (ent->n_ports * sizeof(void *)), GFP_KERNEL); 4262 (ent->n_ports * sizeof(void *)), GFP_KERNEL);
4263 if (!host_set) 4263 if (!host_set)
4264 return 0; 4264 return 0;
4265 memset(host_set, 0, sizeof(struct ata_host_set) + (ent->n_ports * sizeof(void *)));
4266 spin_lock_init(&host_set->lock); 4265 spin_lock_init(&host_set->lock);
4267 4266
4268 host_set->dev = dev; 4267 host_set->dev = dev;
@@ -4302,10 +4301,8 @@ int ata_device_add(const struct ata_probe_ent *ent)
4302 count++; 4301 count++;
4303 } 4302 }
4304 4303
4305 if (!count) { 4304 if (!count)
4306 kfree(host_set); 4305 goto err_free_ret;
4307 return 0;
4308 }
4309 4306
4310 /* obtain irq, that is shared between channels */ 4307 /* obtain irq, that is shared between channels */
4311 if (request_irq(ent->irq, ent->port_ops->irq_handler, ent->irq_flags, 4308 if (request_irq(ent->irq, ent->port_ops->irq_handler, ent->irq_flags,
@@ -4363,6 +4360,7 @@ err_out:
4363 ata_host_remove(host_set->ports[i], 1); 4360 ata_host_remove(host_set->ports[i], 1);
4364 scsi_host_put(host_set->ports[i]->host); 4361 scsi_host_put(host_set->ports[i]->host);
4365 } 4362 }
4363err_free_ret:
4366 kfree(host_set); 4364 kfree(host_set);
4367 VPRINTK("EXIT, returning 0\n"); 4365 VPRINTK("EXIT, returning 0\n");
4368 return 0; 4366 return 0;
@@ -4472,15 +4470,13 @@ ata_probe_ent_alloc(struct device *dev, const struct ata_port_info *port)
4472{ 4470{
4473 struct ata_probe_ent *probe_ent; 4471 struct ata_probe_ent *probe_ent;
4474 4472
4475 probe_ent = kmalloc(sizeof(*probe_ent), GFP_KERNEL); 4473 probe_ent = kzalloc(sizeof(*probe_ent), GFP_KERNEL);
4476 if (!probe_ent) { 4474 if (!probe_ent) {
4477 printk(KERN_ERR DRV_NAME "(%s): out of memory\n", 4475 printk(KERN_ERR DRV_NAME "(%s): out of memory\n",
4478 kobject_name(&(dev->kobj))); 4476 kobject_name(&(dev->kobj)));
4479 return NULL; 4477 return NULL;
4480 } 4478 }
4481 4479
4482 memset(probe_ent, 0, sizeof(*probe_ent));
4483
4484 INIT_LIST_HEAD(&probe_ent->node); 4480 INIT_LIST_HEAD(&probe_ent->node);
4485 probe_ent->dev = dev; 4481 probe_ent->dev = dev;
4486 4482