Commit 06ff37ff authored by Eric Sesterhenn's avatar Eric Sesterhenn Committed by Jens Axboe

[PATCH] kzalloc() conversion in drivers/block

this patch converts drivers/block to kzalloc usage.
Compile tested with allyesconfig.
Signed-off-by: default avatarEric Sesterhenn <snakebyte@gmx.de>
Signed-off-by: default avatarJens Axboe <axboe@suse.de>
parent 28832e83
...@@ -311,11 +311,10 @@ static boolean DAC960_CreateAuxiliaryStructures(DAC960_Controller_T *Controller) ...@@ -311,11 +311,10 @@ static boolean DAC960_CreateAuxiliaryStructures(DAC960_Controller_T *Controller)
CommandsRemaining = CommandAllocationGroupSize; CommandsRemaining = CommandAllocationGroupSize;
CommandGroupByteCount = CommandGroupByteCount =
CommandsRemaining * CommandAllocationLength; CommandsRemaining * CommandAllocationLength;
AllocationPointer = kmalloc(CommandGroupByteCount, GFP_ATOMIC); AllocationPointer = kzalloc(CommandGroupByteCount, GFP_ATOMIC);
if (AllocationPointer == NULL) if (AllocationPointer == NULL)
return DAC960_Failure(Controller, return DAC960_Failure(Controller,
"AUXILIARY STRUCTURE CREATION"); "AUXILIARY STRUCTURE CREATION");
memset(AllocationPointer, 0, CommandGroupByteCount);
} }
Command = (DAC960_Command_T *) AllocationPointer; Command = (DAC960_Command_T *) AllocationPointer;
AllocationPointer += CommandAllocationLength; AllocationPointer += CommandAllocationLength;
...@@ -2709,14 +2708,12 @@ DAC960_DetectController(struct pci_dev *PCI_Device, ...@@ -2709,14 +2708,12 @@ DAC960_DetectController(struct pci_dev *PCI_Device,
void __iomem *BaseAddress; void __iomem *BaseAddress;
int i; int i;
Controller = (DAC960_Controller_T *) Controller = kzalloc(sizeof(DAC960_Controller_T), GFP_ATOMIC);
kmalloc(sizeof(DAC960_Controller_T), GFP_ATOMIC);
if (Controller == NULL) { if (Controller == NULL) {
DAC960_Error("Unable to allocate Controller structure for " DAC960_Error("Unable to allocate Controller structure for "
"Controller at\n", NULL); "Controller at\n", NULL);
return NULL; return NULL;
} }
memset(Controller, 0, sizeof(DAC960_Controller_T));
Controller->ControllerNumber = DAC960_ControllerCount; Controller->ControllerNumber = DAC960_ControllerCount;
DAC960_Controllers[DAC960_ControllerCount++] = Controller; DAC960_Controllers[DAC960_ControllerCount++] = Controller;
Controller->Bus = PCI_Device->bus->number; Controller->Bus = PCI_Device->bus->number;
......
...@@ -996,13 +996,11 @@ static int cciss_ioctl(struct inode *inode, struct file *filep, ...@@ -996,13 +996,11 @@ static int cciss_ioctl(struct inode *inode, struct file *filep,
status = -EINVAL; status = -EINVAL;
goto cleanup1; goto cleanup1;
} }
buff = (unsigned char **) kmalloc(MAXSGENTRIES * buff = kzalloc(MAXSGENTRIES * sizeof(char *), GFP_KERNEL);
sizeof(char *), GFP_KERNEL);
if (!buff) { if (!buff) {
status = -ENOMEM; status = -ENOMEM;
goto cleanup1; goto cleanup1;
} }
memset(buff, 0, MAXSGENTRIES);
buff_size = (int *) kmalloc(MAXSGENTRIES * sizeof(int), buff_size = (int *) kmalloc(MAXSGENTRIES * sizeof(int),
GFP_KERNEL); GFP_KERNEL);
if (!buff_size) { if (!buff_size) {
...@@ -2940,13 +2938,12 @@ static void cciss_getgeometry(int cntl_num) ...@@ -2940,13 +2938,12 @@ static void cciss_getgeometry(int cntl_num)
int block_size; int block_size;
int total_size; int total_size;
ld_buff = kmalloc(sizeof(ReportLunData_struct), GFP_KERNEL); ld_buff = kzalloc(sizeof(ReportLunData_struct), GFP_KERNEL);
if (ld_buff == NULL) if (ld_buff == NULL)
{ {
printk(KERN_ERR "cciss: out of memory\n"); printk(KERN_ERR "cciss: out of memory\n");
return; return;
} }
memset(ld_buff, 0, sizeof(ReportLunData_struct));
size_buff = kmalloc(sizeof( ReadCapdata_struct), GFP_KERNEL); size_buff = kmalloc(sizeof( ReadCapdata_struct), GFP_KERNEL);
if (size_buff == NULL) if (size_buff == NULL)
{ {
...@@ -3060,10 +3057,9 @@ static int alloc_cciss_hba(void) ...@@ -3060,10 +3057,9 @@ static int alloc_cciss_hba(void)
for(i=0; i< MAX_CTLR; i++) { for(i=0; i< MAX_CTLR; i++) {
if (!hba[i]) { if (!hba[i]) {
ctlr_info_t *p; ctlr_info_t *p;
p = kmalloc(sizeof(ctlr_info_t), GFP_KERNEL); p = kzalloc(sizeof(ctlr_info_t), GFP_KERNEL);
if (!p) if (!p)
goto Enomem; goto Enomem;
memset(p, 0, sizeof(ctlr_info_t));
for (n = 0; n < NWD; n++) for (n = 0; n < NWD; n++)
p->gendisk[n] = disk[n]; p->gendisk[n] = disk[n];
hba[i] = p; hba[i] = p;
......
...@@ -1027,12 +1027,11 @@ cciss_update_non_disk_devices(int cntl_num, int hostno) ...@@ -1027,12 +1027,11 @@ cciss_update_non_disk_devices(int cntl_num, int hostno)
int i; int i;
c = (ctlr_info_t *) hba[cntl_num]; c = (ctlr_info_t *) hba[cntl_num];
ld_buff = kmalloc(reportlunsize, GFP_KERNEL); ld_buff = kzalloc(reportlunsize, GFP_KERNEL);
if (ld_buff == NULL) { if (ld_buff == NULL) {
printk(KERN_ERR "cciss: out of memory\n"); printk(KERN_ERR "cciss: out of memory\n");
return; return;
} }
memset(ld_buff, 0, reportlunsize);
inq_buff = kmalloc(OBDR_TAPE_INQ_SIZE, GFP_KERNEL); inq_buff = kmalloc(OBDR_TAPE_INQ_SIZE, GFP_KERNEL);
if (inq_buff == NULL) { if (inq_buff == NULL) {
printk(KERN_ERR "cciss: out of memory\n"); printk(KERN_ERR "cciss: out of memory\n");
......
...@@ -224,10 +224,9 @@ static void bpck6_log_adapter( PIA *pi, char * scratch, int verbose ) ...@@ -224,10 +224,9 @@ static void bpck6_log_adapter( PIA *pi, char * scratch, int verbose )
static int bpck6_init_proto(PIA *pi) static int bpck6_init_proto(PIA *pi)
{ {
Interface *p = kmalloc(sizeof(Interface), GFP_KERNEL); Interface *p = kzalloc(sizeof(Interface), GFP_KERNEL);
if (p) { if (p) {
memset(p, 0, sizeof(Interface));
pi->private = (unsigned long)p; pi->private = (unsigned long)p;
return 0; return 0;
} }
......
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