From 24669f75a3231fa37444977c92d1f4838bec1233 Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Mon, 16 Jan 2006 10:31:18 -0500 Subject: [SCSI] SCSI core kmalloc2kzalloc Change the core SCSI code to use kzalloc rather than kmalloc+memset where possible. Signed-off-by: Jes Sorensen Signed-off-by: James Bottomley --- drivers/scsi/st.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'drivers/scsi/st.c') diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index 7f96f33c1bb1..f0606da19d02 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c @@ -3590,12 +3590,11 @@ static struct st_buffer * i = sizeof(struct st_buffer) + (max_sg - 1) * sizeof(struct scatterlist) + max_sg * sizeof(struct st_buf_fragment); - tb = kmalloc(i, priority); + tb = kzalloc(i, priority); if (!tb) { printk(KERN_NOTICE "st: Can't allocate new tape buffer.\n"); return NULL; } - memset(tb, 0, i); tb->frp_segs = tb->orig_frp_segs = 0; tb->use_sg = max_sg; tb->frp = (struct st_buf_fragment *)(&(tb->sg[0]) + max_sg); @@ -3924,14 +3923,13 @@ static int st_probe(struct device *dev) goto out_put_disk; } - tmp_da = kmalloc(tmp_dev_max * sizeof(struct scsi_tape *), GFP_ATOMIC); + tmp_da = kzalloc(tmp_dev_max * sizeof(struct scsi_tape *), GFP_ATOMIC); if (tmp_da == NULL) { write_unlock(&st_dev_arr_lock); printk(KERN_ERR "st: Can't extend device array.\n"); goto out_put_disk; } - memset(tmp_da, 0, tmp_dev_max * sizeof(struct scsi_tape *)); if (scsi_tapes != NULL) { memcpy(tmp_da, scsi_tapes, st_dev_max * sizeof(struct scsi_tape *)); @@ -3948,13 +3946,12 @@ static int st_probe(struct device *dev) if (i >= st_dev_max) panic("scsi_devices corrupt (st)"); - tpnt = kmalloc(sizeof(struct scsi_tape), GFP_ATOMIC); + tpnt = kzalloc(sizeof(struct scsi_tape), GFP_ATOMIC); if (tpnt == NULL) { write_unlock(&st_dev_arr_lock); printk(KERN_ERR "st: Can't allocate device descriptor.\n"); goto out_put_disk; } - memset(tpnt, 0, sizeof(struct scsi_tape)); kref_init(&tpnt->kref); tpnt->disk = disk; sprintf(disk->disk_name, "st%d", i); -- cgit v1.2.1