summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/sg.c
diff options
context:
space:
mode:
authorJes Sorensen <jes@sgi.com>2006-01-16 10:31:18 -0500
committer <jejb@mulgrave.il.steeleye.com>2006-02-27 22:55:02 -0600
commit24669f75a3231fa37444977c92d1f4838bec1233 (patch)
tree3b64076b7d031aa31b95caeb512fb7e68b5fd28f /drivers/scsi/sg.c
parentb9a33cebac70d6f67a769ce8d4078fee2b254ada (diff)
downloadlinux-24669f75a3231fa37444977c92d1f4838bec1233.tar.bz2
[SCSI] SCSI core kmalloc2kzalloc
Change the core SCSI code to use kzalloc rather than kmalloc+memset where possible. Signed-off-by: Jes Sorensen <jes@sgi.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/sg.c')
-rw-r--r--drivers/scsi/sg.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 2a547538d444..ecf2f6010e76 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -1361,7 +1361,7 @@ static int sg_alloc(struct gendisk *disk, struct scsi_device *scsidp)
void *old_sg_dev_arr = NULL;
int k, error;
- sdp = kmalloc(sizeof(Sg_device), GFP_KERNEL);
+ sdp = kzalloc(sizeof(Sg_device), GFP_KERNEL);
if (!sdp) {
printk(KERN_WARNING "kmalloc Sg_device failure\n");
return -ENOMEM;
@@ -1373,12 +1373,11 @@ static int sg_alloc(struct gendisk *disk, struct scsi_device *scsidp)
int tmp_dev_max = sg_nr_dev + SG_DEV_ARR_LUMP;
write_unlock_irqrestore(&sg_dev_arr_lock, iflags);
- tmp_da = kmalloc(tmp_dev_max * sizeof(Sg_device *), GFP_KERNEL);
+ tmp_da = kzalloc(tmp_dev_max * sizeof(Sg_device *), GFP_KERNEL);
if (unlikely(!tmp_da))
goto expand_failed;
write_lock_irqsave(&sg_dev_arr_lock, iflags);
- memset(tmp_da, 0, tmp_dev_max * sizeof(Sg_device *));
memcpy(tmp_da, sg_dev_arr, sg_dev_max * sizeof(Sg_device *));
old_sg_dev_arr = sg_dev_arr;
sg_dev_arr = tmp_da;
@@ -1391,7 +1390,6 @@ static int sg_alloc(struct gendisk *disk, struct scsi_device *scsidp)
if (unlikely(k >= SG_MAX_DEVS))
goto overflow;
- memset(sdp, 0, sizeof(*sdp));
SCSI_LOG_TIMEOUT(3, printk("sg_alloc: dev=%d \n", k));
sprintf(disk->disk_name, "sg%d", k);
disk->first_minor = k;