Convert more 'alloc_obj' cases to default GFP_KERNEL arguments

This converts some of the visually simpler cases that have been split
over multiple lines.  I only did the ones that are easy to verify the
resulting diff by having just that final GFP_KERNEL argument on the next
line.

Somebody should probably do a proper coccinelle script for this, but for
me the trivial script actually resulted in an assertion failure in the
middle of the script.  I probably had made it a bit _too_ trivial.

So after fighting that far a while I decided to just do some of the
syntactically simpler cases with variations of the previous 'sed'
scripts.

The more syntactically complex multi-line cases would mostly really want
whitespace cleanup anyway.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Linus Torvalds
2026-02-21 20:03:00 -08:00
parent 323bbfcf1e
commit 32a92f8c89
826 changed files with 1211 additions and 2422 deletions

View File

@@ -3932,8 +3932,7 @@ static int receive_sizes(struct drbd_connection *connection, struct packet_info
if (my_usize != p_usize) {
struct disk_conf *old_disk_conf, *new_disk_conf = NULL;
new_disk_conf = kzalloc_obj(struct disk_conf,
GFP_KERNEL);
new_disk_conf = kzalloc_obj(struct disk_conf);
if (!new_disk_conf) {
put_ldev(device);
return -ENOMEM;

View File

@@ -401,8 +401,7 @@ static int ps3vram_cache_init(struct ps3_system_bus_device *dev)
priv->cache.page_count = CACHE_PAGE_COUNT;
priv->cache.page_size = CACHE_PAGE_SIZE;
priv->cache.tags = kzalloc_objs(struct ps3vram_tag, CACHE_PAGE_COUNT,
GFP_KERNEL);
priv->cache.tags = kzalloc_objs(struct ps3vram_tag, CACHE_PAGE_COUNT);
if (!priv->cache.tags)
return -ENOMEM;

View File

@@ -846,8 +846,7 @@ again:
* We are using persistent grants, the grant is
* not mapped but we might have room for it.
*/
persistent_gnt = kmalloc_obj(struct persistent_gnt,
GFP_KERNEL);
persistent_gnt = kmalloc_obj(struct persistent_gnt);
if (!persistent_gnt) {
/*
* If we don't have enough memory to

View File

@@ -131,8 +131,7 @@ static int xen_blkif_alloc_rings(struct xen_blkif *blkif)
{
unsigned int r;
blkif->rings = kzalloc_objs(struct xen_blkif_ring, blkif->nr_rings,
GFP_KERNEL);
blkif->rings = kzalloc_objs(struct xen_blkif_ring, blkif->nr_rings);
if (!blkif->rings)
return -ENOMEM;
@@ -1014,14 +1013,12 @@ static int read_per_ring_refs(struct xen_blkif_ring *ring, const char *dir)
goto fail;
list_add_tail(&req->free_list, &ring->pending_free);
for (j = 0; j < MAX_INDIRECT_SEGMENTS; j++) {
req->segments[j] = kzalloc_obj(*req->segments[0],
GFP_KERNEL);
req->segments[j] = kzalloc_obj(*req->segments[0]);
if (!req->segments[j])
goto fail;
}
for (j = 0; j < MAX_INDIRECT_PAGES; j++) {
req->indirect_pages[j] = kzalloc_obj(*req->indirect_pages[0],
GFP_KERNEL);
req->indirect_pages[j] = kzalloc_obj(*req->indirect_pages[0]);
if (!req->indirect_pages[j])
goto fail;
}

View File

@@ -2207,8 +2207,7 @@ static int blkfront_setup_indirect(struct blkfront_ring_info *rinfo)
for (i = 0; i < BLK_RING_SIZE(info); i++) {
rinfo->shadow[i].grants_used =
kvzalloc_objs(rinfo->shadow[i].grants_used[0], grants,
GFP_KERNEL);
kvzalloc_objs(rinfo->shadow[i].grants_used[0], grants);
rinfo->shadow[i].sg = kvzalloc_objs(rinfo->shadow[i].sg[0],
psegs, GFP_KERNEL);
if (info->max_indirect_segments)

View File

@@ -187,8 +187,7 @@ static int z2_open(struct gendisk *disk, blk_mode_t mode)
(unsigned long)z_remap_nocache_nonser(paddr, size);
#endif
z2ram_map =
kmalloc_objs(z2ram_map[0], size / Z2RAM_CHUNKSIZE,
GFP_KERNEL);
kmalloc_objs(z2ram_map[0], size / Z2RAM_CHUNKSIZE);
if (z2ram_map == NULL) {
printk(KERN_ERR DEVICE_NAME
": cannot get mem for z2ram_map\n");