Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] kzalloc() conversion in drivers/block

this patch converts drivers/block to kzalloc usage.
Compile tested with allyesconfig.

Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
Signed-off-by: Jens Axboe <axboe@suse.de>

authored by

Eric Sesterhenn and committed by
Jens Axboe
06ff37ff 28832e83

+7 -16
+2 -5
drivers/block/DAC960.c
··· 311 311 CommandsRemaining = CommandAllocationGroupSize; 312 312 CommandGroupByteCount = 313 313 CommandsRemaining * CommandAllocationLength; 314 - AllocationPointer = kmalloc(CommandGroupByteCount, GFP_ATOMIC); 314 + AllocationPointer = kzalloc(CommandGroupByteCount, GFP_ATOMIC); 315 315 if (AllocationPointer == NULL) 316 316 return DAC960_Failure(Controller, 317 317 "AUXILIARY STRUCTURE CREATION"); 318 - memset(AllocationPointer, 0, CommandGroupByteCount); 319 318 } 320 319 Command = (DAC960_Command_T *) AllocationPointer; 321 320 AllocationPointer += CommandAllocationLength; ··· 2708 2709 void __iomem *BaseAddress; 2709 2710 int i; 2710 2711 2711 - Controller = (DAC960_Controller_T *) 2712 - kmalloc(sizeof(DAC960_Controller_T), GFP_ATOMIC); 2712 + Controller = kzalloc(sizeof(DAC960_Controller_T), GFP_ATOMIC); 2713 2713 if (Controller == NULL) { 2714 2714 DAC960_Error("Unable to allocate Controller structure for " 2715 2715 "Controller at\n", NULL); 2716 2716 return NULL; 2717 2717 } 2718 - memset(Controller, 0, sizeof(DAC960_Controller_T)); 2719 2718 Controller->ControllerNumber = DAC960_ControllerCount; 2720 2719 DAC960_Controllers[DAC960_ControllerCount++] = Controller; 2721 2720 Controller->Bus = PCI_Device->bus->number;
+3 -7
drivers/block/cciss.c
··· 996 996 status = -EINVAL; 997 997 goto cleanup1; 998 998 } 999 - buff = (unsigned char **) kmalloc(MAXSGENTRIES * 1000 - sizeof(char *), GFP_KERNEL); 999 + buff = kzalloc(MAXSGENTRIES * sizeof(char *), GFP_KERNEL); 1001 1000 if (!buff) { 1002 1001 status = -ENOMEM; 1003 1002 goto cleanup1; 1004 1003 } 1005 - memset(buff, 0, MAXSGENTRIES); 1006 1004 buff_size = (int *) kmalloc(MAXSGENTRIES * sizeof(int), 1007 1005 GFP_KERNEL); 1008 1006 if (!buff_size) { ··· 2938 2940 int block_size; 2939 2941 int total_size; 2940 2942 2941 - ld_buff = kmalloc(sizeof(ReportLunData_struct), GFP_KERNEL); 2943 + ld_buff = kzalloc(sizeof(ReportLunData_struct), GFP_KERNEL); 2942 2944 if (ld_buff == NULL) 2943 2945 { 2944 2946 printk(KERN_ERR "cciss: out of memory\n"); 2945 2947 return; 2946 2948 } 2947 - memset(ld_buff, 0, sizeof(ReportLunData_struct)); 2948 2949 size_buff = kmalloc(sizeof( ReadCapdata_struct), GFP_KERNEL); 2949 2950 if (size_buff == NULL) 2950 2951 { ··· 3057 3060 for(i=0; i< MAX_CTLR; i++) { 3058 3061 if (!hba[i]) { 3059 3062 ctlr_info_t *p; 3060 - p = kmalloc(sizeof(ctlr_info_t), GFP_KERNEL); 3063 + p = kzalloc(sizeof(ctlr_info_t), GFP_KERNEL); 3061 3064 if (!p) 3062 3065 goto Enomem; 3063 - memset(p, 0, sizeof(ctlr_info_t)); 3064 3066 for (n = 0; n < NWD; n++) 3065 3067 p->gendisk[n] = disk[n]; 3066 3068 hba[i] = p;
+1 -2
drivers/block/cciss_scsi.c
··· 1027 1027 int i; 1028 1028 1029 1029 c = (ctlr_info_t *) hba[cntl_num]; 1030 - ld_buff = kmalloc(reportlunsize, GFP_KERNEL); 1030 + ld_buff = kzalloc(reportlunsize, GFP_KERNEL); 1031 1031 if (ld_buff == NULL) { 1032 1032 printk(KERN_ERR "cciss: out of memory\n"); 1033 1033 return; 1034 1034 } 1035 - memset(ld_buff, 0, reportlunsize); 1036 1035 inq_buff = kmalloc(OBDR_TAPE_INQ_SIZE, GFP_KERNEL); 1037 1036 if (inq_buff == NULL) { 1038 1037 printk(KERN_ERR "cciss: out of memory\n");
+1 -2
drivers/block/paride/bpck6.c
··· 224 224 225 225 static int bpck6_init_proto(PIA *pi) 226 226 { 227 - Interface *p = kmalloc(sizeof(Interface), GFP_KERNEL); 227 + Interface *p = kzalloc(sizeof(Interface), GFP_KERNEL); 228 228 229 229 if (p) { 230 - memset(p, 0, sizeof(Interface)); 231 230 pi->private = (unsigned long)p; 232 231 return 0; 233 232 }