return -EPERM;
}
num_map_regions = bar_desc->num_mappable_regions;
- map_regions = kzalloc(
- num_map_regions * sizeof(*bar_desc->mappable_regions),
- GFP_KERNEL);
+ map_regions = kcalloc(num_map_regions,
+ sizeof(*bar_desc->mappable_regions),
+ GFP_KERNEL);
if (map_regions) {
memcpy(map_regions, bar_desc->mappable_regions,
num_map_regions *
interrupt_data->wire_interrupt_offsets = wire_int_offsets;
/* Allocate all dynamic structures. */
- interrupt_data->msix_entries = kzalloc(
- sizeof(struct msix_entry) * num_interrupts, GFP_KERNEL);
+ interrupt_data->msix_entries = kcalloc(num_interrupts,
+ sizeof(struct msix_entry),
+ GFP_KERNEL);
if (!interrupt_data->msix_entries) {
kfree(interrupt_data);
return -ENOMEM;
}
- interrupt_data->eventfd_ctxs = kzalloc(
- sizeof(struct eventfd_ctx *) * num_interrupts, GFP_KERNEL);
+ interrupt_data->eventfd_ctxs = kcalloc(num_interrupts,
+ sizeof(struct eventfd_ctx *),
+ GFP_KERNEL);
if (!interrupt_data->eventfd_ctxs) {
kfree(interrupt_data->msix_entries);
kfree(interrupt_data);
return -ENOMEM;
}
- interrupt_data->interrupt_counts = kzalloc(
- sizeof(ulong) * num_interrupts, GFP_KERNEL);
+ interrupt_data->interrupt_counts = kcalloc(num_interrupts,
+ sizeof(ulong),
+ GFP_KERNEL);
if (!interrupt_data->interrupt_counts) {
kfree(interrupt_data->eventfd_ctxs);
kfree(interrupt_data->msix_entries);
gasket_dev->page_table[index]->num_coherent_pages = num_pages;
/* allocate the physical memory block */
- gasket_dev->page_table[index]->coherent_pages = kzalloc(
- num_pages * sizeof(struct gasket_coherent_page_entry),
- GFP_KERNEL);
+ gasket_dev->page_table[index]->coherent_pages =
+ kcalloc(num_pages, sizeof(struct gasket_coherent_page_entry),
+ GFP_KERNEL);
if (!gasket_dev->page_table[index]->coherent_pages)
goto nomem;
*dma_address = 0;
device = mapping->device;
legacy_device = mapping->legacy_device;
num_files_to_remove = mapping->attribute_count;
- files_to_remove = kzalloc(
- num_files_to_remove * sizeof(*files_to_remove),
- GFP_KERNEL);
+ files_to_remove = kcalloc(num_files_to_remove,
+ sizeof(*files_to_remove),
+ GFP_KERNEL);
for (i = 0; i < num_files_to_remove; i++)
files_to_remove[i] = mapping->attributes[i].attr;
kref_init(&mapping->refcount);
mapping->device = device;
mapping->gasket_dev = gasket_dev;
- mapping->attributes = kzalloc(
- GASKET_SYSFS_MAX_NODES * sizeof(*mapping->attributes),
- GFP_KERNEL);
+ mapping->attributes = kcalloc(GASKET_SYSFS_MAX_NODES,
+ sizeof(*mapping->attributes),
+ GFP_KERNEL);
mapping->attribute_count = 0;
if (!mapping->attributes) {
gasket_nodev_error("Unable to allocate sysfs attribute array.");