[PATCH] s390: kzalloc() conversion in arch/s390
Convert all kmalloc + memset sequences in arch/s390 to kzalloc usage. Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
96641ee1e4
commit
fb630517f0
@ -531,12 +531,11 @@ int appldata_register_ops(struct appldata_ops *ops)
|
|||||||
P_ERROR("ctl_nr %i already in use!\n", ops->ctl_nr);
|
P_ERROR("ctl_nr %i already in use!\n", ops->ctl_nr);
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
ops->ctl_table = kmalloc(4*sizeof(struct ctl_table), GFP_KERNEL);
|
ops->ctl_table = kzalloc(4*sizeof(struct ctl_table), GFP_KERNEL);
|
||||||
if (ops->ctl_table == NULL) {
|
if (ops->ctl_table == NULL) {
|
||||||
P_ERROR("Not enough memory for %s ctl_table!\n", ops->name);
|
P_ERROR("Not enough memory for %s ctl_table!\n", ops->name);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
memset(ops->ctl_table, 0, 4*sizeof(struct ctl_table));
|
|
||||||
|
|
||||||
spin_lock(&appldata_ops_lock);
|
spin_lock(&appldata_ops_lock);
|
||||||
list_for_each(lh, &appldata_ops_list) {
|
list_for_each(lh, &appldata_ops_list) {
|
||||||
|
@ -204,16 +204,13 @@ debug_areas_alloc(int pages_per_area, int nr_areas)
|
|||||||
goto fail_malloc_areas2;
|
goto fail_malloc_areas2;
|
||||||
}
|
}
|
||||||
for(j = 0; j < pages_per_area; j++) {
|
for(j = 0; j < pages_per_area; j++) {
|
||||||
areas[i][j] = (debug_entry_t*)kmalloc(PAGE_SIZE,
|
areas[i][j] = kzalloc(PAGE_SIZE, GFP_KERNEL);
|
||||||
GFP_KERNEL);
|
|
||||||
if(!areas[i][j]) {
|
if(!areas[i][j]) {
|
||||||
for(j--; j >=0 ; j--) {
|
for(j--; j >=0 ; j--) {
|
||||||
kfree(areas[i][j]);
|
kfree(areas[i][j]);
|
||||||
}
|
}
|
||||||
kfree(areas[i]);
|
kfree(areas[i]);
|
||||||
goto fail_malloc_areas2;
|
goto fail_malloc_areas2;
|
||||||
} else {
|
|
||||||
memset(areas[i][j],0,PAGE_SIZE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -249,14 +246,12 @@ debug_info_alloc(char *name, int pages_per_area, int nr_areas, int buf_size,
|
|||||||
rc = (debug_info_t*) kmalloc(sizeof(debug_info_t), GFP_KERNEL);
|
rc = (debug_info_t*) kmalloc(sizeof(debug_info_t), GFP_KERNEL);
|
||||||
if(!rc)
|
if(!rc)
|
||||||
goto fail_malloc_rc;
|
goto fail_malloc_rc;
|
||||||
rc->active_entries = (int*)kmalloc(nr_areas * sizeof(int), GFP_KERNEL);
|
rc->active_entries = kcalloc(nr_areas, sizeof(int), GFP_KERNEL);
|
||||||
if(!rc->active_entries)
|
if(!rc->active_entries)
|
||||||
goto fail_malloc_active_entries;
|
goto fail_malloc_active_entries;
|
||||||
memset(rc->active_entries, 0, nr_areas * sizeof(int));
|
rc->active_pages = kcalloc(nr_areas, sizeof(int), GFP_KERNEL);
|
||||||
rc->active_pages = (int*)kmalloc(nr_areas * sizeof(int), GFP_KERNEL);
|
|
||||||
if(!rc->active_pages)
|
if(!rc->active_pages)
|
||||||
goto fail_malloc_active_pages;
|
goto fail_malloc_active_pages;
|
||||||
memset(rc->active_pages, 0, nr_areas * sizeof(int));
|
|
||||||
if((mode == ALL_AREAS) && (pages_per_area != 0)){
|
if((mode == ALL_AREAS) && (pages_per_area != 0)){
|
||||||
rc->areas = debug_areas_alloc(pages_per_area, nr_areas);
|
rc->areas = debug_areas_alloc(pages_per_area, nr_areas);
|
||||||
if(!rc->areas)
|
if(!rc->areas)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user