Commit ab552204 authored by vignesh.babu@wipro.com's avatar vignesh.babu@wipro.com Committed by James Bottomley

[SCSI] dpt_i2o: kmalloc/memset->kzalloc

Replacing kmalloc/memset combination with kzalloc.
Signed-off-by: default avatarvignesh babu <vignesh.babu@wipro.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 4530a169
...@@ -1309,13 +1309,12 @@ static s32 adpt_i2o_reset_hba(adpt_hba* pHba) ...@@ -1309,13 +1309,12 @@ static s32 adpt_i2o_reset_hba(adpt_hba* pHba)
schedule_timeout_uninterruptible(1); schedule_timeout_uninterruptible(1);
} while (m == EMPTY_QUEUE); } while (m == EMPTY_QUEUE);
status = kmalloc(4, GFP_KERNEL|ADDR32); status = kzalloc(4, GFP_KERNEL|ADDR32);
if(status == NULL) { if(status == NULL) {
adpt_send_nop(pHba, m); adpt_send_nop(pHba, m);
printk(KERN_ERR"IOP reset failed - no free memory.\n"); printk(KERN_ERR"IOP reset failed - no free memory.\n");
return -ENOMEM; return -ENOMEM;
} }
memset(status,0,4);
msg[0]=EIGHT_WORD_MSG_SIZE|SGL_OFFSET_0; msg[0]=EIGHT_WORD_MSG_SIZE|SGL_OFFSET_0;
msg[1]=I2O_CMD_ADAPTER_RESET<<24|HOST_TID<<12|ADAPTER_TID; msg[1]=I2O_CMD_ADAPTER_RESET<<24|HOST_TID<<12|ADAPTER_TID;
...@@ -1505,21 +1504,19 @@ static int adpt_i2o_parse_lct(adpt_hba* pHba) ...@@ -1505,21 +1504,19 @@ static int adpt_i2o_parse_lct(adpt_hba* pHba)
continue; continue;
} }
if( pHba->channel[bus_no].device[scsi_id] == NULL){ if( pHba->channel[bus_no].device[scsi_id] == NULL){
pDev = kmalloc(sizeof(struct adpt_device),GFP_KERNEL); pDev = kzalloc(sizeof(struct adpt_device),GFP_KERNEL);
if(pDev == NULL) { if(pDev == NULL) {
return -ENOMEM; return -ENOMEM;
} }
pHba->channel[bus_no].device[scsi_id] = pDev; pHba->channel[bus_no].device[scsi_id] = pDev;
memset(pDev,0,sizeof(struct adpt_device));
} else { } else {
for( pDev = pHba->channel[bus_no].device[scsi_id]; for( pDev = pHba->channel[bus_no].device[scsi_id];
pDev->next_lun; pDev = pDev->next_lun){ pDev->next_lun; pDev = pDev->next_lun){
} }
pDev->next_lun = kmalloc(sizeof(struct adpt_device),GFP_KERNEL); pDev->next_lun = kzalloc(sizeof(struct adpt_device),GFP_KERNEL);
if(pDev->next_lun == NULL) { if(pDev->next_lun == NULL) {
return -ENOMEM; return -ENOMEM;
} }
memset(pDev->next_lun,0,sizeof(struct adpt_device));
pDev = pDev->next_lun; pDev = pDev->next_lun;
} }
pDev->tid = tid; pDev->tid = tid;
...@@ -1668,12 +1665,11 @@ static int adpt_i2o_passthru(adpt_hba* pHba, u32 __user *arg) ...@@ -1668,12 +1665,11 @@ static int adpt_i2o_passthru(adpt_hba* pHba, u32 __user *arg)
reply_size = REPLY_FRAME_SIZE; reply_size = REPLY_FRAME_SIZE;
} }
reply_size *= 4; reply_size *= 4;
reply = kmalloc(REPLY_FRAME_SIZE*4, GFP_KERNEL); reply = kzalloc(REPLY_FRAME_SIZE*4, GFP_KERNEL);
if(reply == NULL) { if(reply == NULL) {
printk(KERN_WARNING"%s: Could not allocate reply buffer\n",pHba->name); printk(KERN_WARNING"%s: Could not allocate reply buffer\n",pHba->name);
return -ENOMEM; return -ENOMEM;
} }
memset(reply,0,REPLY_FRAME_SIZE*4);
sg_offset = (msg[0]>>4)&0xf; sg_offset = (msg[0]>>4)&0xf;
msg[2] = 0x40000000; // IOCTL context msg[2] = 0x40000000; // IOCTL context
msg[3] = (u32)reply; msg[3] = (u32)reply;
...@@ -2445,7 +2441,7 @@ static s32 adpt_i2o_reparse_lct(adpt_hba* pHba) ...@@ -2445,7 +2441,7 @@ static s32 adpt_i2o_reparse_lct(adpt_hba* pHba)
} }
pDev = pHba->channel[bus_no].device[scsi_id]; pDev = pHba->channel[bus_no].device[scsi_id];
if( pDev == NULL){ if( pDev == NULL){
pDev = kmalloc(sizeof(struct adpt_device),GFP_KERNEL); pDev = kzalloc(sizeof(struct adpt_device),GFP_KERNEL);
if(pDev == NULL) { if(pDev == NULL) {
return -ENOMEM; return -ENOMEM;
} }
...@@ -2454,12 +2450,11 @@ static s32 adpt_i2o_reparse_lct(adpt_hba* pHba) ...@@ -2454,12 +2450,11 @@ static s32 adpt_i2o_reparse_lct(adpt_hba* pHba)
while (pDev->next_lun) { while (pDev->next_lun) {
pDev = pDev->next_lun; pDev = pDev->next_lun;
} }
pDev = pDev->next_lun = kmalloc(sizeof(struct adpt_device),GFP_KERNEL); pDev = pDev->next_lun = kzalloc(sizeof(struct adpt_device),GFP_KERNEL);
if(pDev == NULL) { if(pDev == NULL) {
return -ENOMEM; return -ENOMEM;
} }
} }
memset(pDev,0,sizeof(struct adpt_device));
pDev->tid = d->lct_data.tid; pDev->tid = d->lct_data.tid;
pDev->scsi_channel = bus_no; pDev->scsi_channel = bus_no;
pDev->scsi_id = scsi_id; pDev->scsi_id = scsi_id;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment