Convert 'alloc_obj' family to use the new default GFP_KERNEL argument

This was done entirely with mindless brute force, using

    git grep -l '\<k[vmz]*alloc_objs*(.*, GFP_KERNEL)' |
        xargs sed -i 's/\(alloc_objs*(.*\), GFP_KERNEL)/\1)/'

to convert the new alloc_obj() users that had a simple GFP_KERNEL
argument to just drop that argument.

Note that due to the extreme simplicity of the scripting, any slightly
more complex cases spread over multiple lines would not be triggered:
they definitely exist, but this covers the vast bulk of the cases, and
the resulting diff is also then easier to check automatically.

For the same reason the 'flex' versions will be done as a separate
conversion.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Linus Torvalds
2026-02-21 16:37:42 -08:00
parent e19e1b480a
commit bf4afc53b7
6673 changed files with 13013 additions and 13013 deletions

View File

@@ -927,7 +927,7 @@ static int virtballoon_probe(struct virtio_device *vdev)
return -EINVAL;
}
vdev->priv = vb = kzalloc_obj(*vb, GFP_KERNEL);
vdev->priv = vb = kzalloc_obj(*vb);
if (!vb) {
err = -ENOMEM;
goto out;

View File

@@ -229,7 +229,7 @@ static int virtinput_probe(struct virtio_device *vdev)
if (!virtio_has_feature(vdev, VIRTIO_F_VERSION_1))
return -ENODEV;
vi = kzalloc_obj(*vi, GFP_KERNEL);
vi = kzalloc_obj(*vi);
if (!vi)
return -ENOMEM;

View File

@@ -2940,7 +2940,7 @@ static int virtio_mem_probe(struct virtio_device *vdev)
BUILD_BUG_ON(sizeof(struct virtio_mem_req) != 24);
BUILD_BUG_ON(sizeof(struct virtio_mem_resp) != 10);
vdev->priv = vm = kzalloc_obj(*vm, GFP_KERNEL);
vdev->priv = vm = kzalloc_obj(*vm);
if (!vm)
return -ENOMEM;

View File

@@ -575,7 +575,7 @@ static int virtio_mmio_probe(struct platform_device *pdev)
unsigned long magic;
int rc;
vm_dev = kzalloc_obj(*vm_dev, GFP_KERNEL);
vm_dev = kzalloc_obj(*vm_dev);
if (!vm_dev)
return -ENOMEM;

View File

@@ -124,7 +124,7 @@ static int virtio_pci_admin_legacy_io_read(struct pci_dev *pdev, u16 opcode,
if (vf_id < 0)
return vf_id;
data = kzalloc_obj(*data, GFP_KERNEL);
data = kzalloc_obj(*data);
if (!data)
return -ENOMEM;
@@ -210,7 +210,7 @@ int virtio_pci_admin_legacy_io_notify_info(struct pci_dev *pdev,
if (vf_id < 0)
return vf_id;
result = kzalloc_obj(*result, GFP_KERNEL);
result = kzalloc_obj(*result);
if (!result)
return -ENOMEM;

View File

@@ -210,7 +210,7 @@ static struct virtqueue *vp_setup_vq(struct virtio_device *vdev, unsigned int in
struct virtio_pci_vq_info **p_info)
{
struct virtio_pci_device *vp_dev = to_vp_device(vdev);
struct virtio_pci_vq_info *info = kmalloc_obj(*info, GFP_KERNEL);
struct virtio_pci_vq_info *info = kmalloc_obj(*info);
struct virtqueue *vq;
unsigned long flags;
@@ -386,7 +386,7 @@ static int vp_find_vqs_msix(struct virtio_device *vdev, unsigned int nvqs,
bool per_vq_vectors;
u16 avq_num = 0;
vp_dev->vqs = kzalloc_objs(*vp_dev->vqs, nvqs, GFP_KERNEL);
vp_dev->vqs = kzalloc_objs(*vp_dev->vqs, nvqs);
if (!vp_dev->vqs)
return -ENOMEM;
@@ -463,7 +463,7 @@ static int vp_find_vqs_intx(struct virtio_device *vdev, unsigned int nvqs,
struct virtqueue *vq;
u16 avq_num = 0;
vp_dev->vqs = kzalloc_objs(*vp_dev->vqs, nvqs, GFP_KERNEL);
vp_dev->vqs = kzalloc_objs(*vp_dev->vqs, nvqs);
if (!vp_dev->vqs)
return -ENOMEM;
@@ -685,7 +685,7 @@ static int virtio_pci_probe(struct pci_dev *pci_dev,
int rc;
/* allocate our structure and fill it out */
vp_dev = kzalloc_obj(struct virtio_pci_device, GFP_KERNEL);
vp_dev = kzalloc_obj(struct virtio_pci_device);
if (!vp_dev)
return -ENOMEM;

View File

@@ -137,11 +137,11 @@ int vp_modern_admin_cmd_exec(struct virtio_device *vdev,
if (!virtio_has_feature(vdev, VIRTIO_F_ADMIN_VQ))
return -EOPNOTSUPP;
va_status = kzalloc_obj(*va_status, GFP_KERNEL);
va_status = kzalloc_obj(*va_status);
if (!va_status)
return -ENOMEM;
va_hdr = kzalloc_obj(*va_hdr, GFP_KERNEL);
va_hdr = kzalloc_obj(*va_hdr);
if (!va_hdr) {
ret = -ENOMEM;
goto err_alloc;
@@ -204,7 +204,7 @@ static void virtio_pci_admin_cmd_list_init(struct virtio_device *virtio_dev)
__le64 *data;
int ret;
data = kzalloc_obj(*data, GFP_KERNEL);
data = kzalloc_obj(*data);
if (!data)
return;
@@ -246,11 +246,11 @@ virtio_pci_admin_cmd_dev_parts_objects_enable(struct virtio_device *virtio_dev)
u16 set_data_size;
int ret;
get_data = kzalloc_obj(*get_data, GFP_KERNEL);
get_data = kzalloc_obj(*get_data);
if (!get_data)
return;
result = kzalloc_obj(*result, GFP_KERNEL);
result = kzalloc_obj(*result);
if (!result)
goto end;
@@ -310,7 +310,7 @@ static void virtio_pci_admin_cmd_cap_init(struct virtio_device *virtio_dev)
struct scatterlist result_sg;
int ret;
data = kzalloc_obj(*data, GFP_KERNEL);
data = kzalloc_obj(*data);
if (!data)
return;
@@ -929,7 +929,7 @@ int virtio_pci_admin_mode_set(struct pci_dev *pdev, u8 flags)
if (vf_id < 0)
return vf_id;
data = kzalloc_obj(*data, GFP_KERNEL);
data = kzalloc_obj(*data);
if (!data)
return -ENOMEM;
@@ -1054,7 +1054,7 @@ int virtio_pci_admin_obj_destroy(struct pci_dev *pdev, u16 obj_type, u32 id)
if (obj_type != VIRTIO_RESOURCE_OBJ_DEV_PARTS)
return -EINVAL;
data = kzalloc_obj(*data, GFP_KERNEL);
data = kzalloc_obj(*data);
if (!data)
return -ENOMEM;
@@ -1109,11 +1109,11 @@ int virtio_pci_admin_dev_parts_metadata_get(struct pci_dev *pdev, u16 obj_type,
if (vf_id < 0)
return vf_id;
data = kzalloc_obj(*data, GFP_KERNEL);
data = kzalloc_obj(*data);
if (!data)
return -ENOMEM;
result = kzalloc_obj(*result, GFP_KERNEL);
result = kzalloc_obj(*result);
if (!result) {
ret = -ENOMEM;
goto end;
@@ -1173,7 +1173,7 @@ int virtio_pci_admin_dev_parts_get(struct pci_dev *pdev, u16 obj_type, u32 id,
if (vf_id < 0)
return vf_id;
data = kzalloc_obj(*data, GFP_KERNEL);
data = kzalloc_obj(*data);
if (!data)
return -ENOMEM;

View File

@@ -1209,7 +1209,7 @@ static int vring_alloc_state_extra_split(struct vring_virtqueue_split *vring_spl
struct vring_desc_extra *extra;
u32 num = vring_split->vring.num;
state = kmalloc_objs(struct vring_desc_state_split, num, GFP_KERNEL);
state = kmalloc_objs(struct vring_desc_state_split, num);
if (!state)
goto err_state;
@@ -1308,7 +1308,7 @@ static struct virtqueue *__vring_new_virtqueue_split(unsigned int index,
struct vring_virtqueue *vq;
int err;
vq = kmalloc_obj(*vq, GFP_KERNEL);
vq = kmalloc_obj(*vq);
if (!vq)
return NULL;
@@ -2349,7 +2349,7 @@ static struct vring_desc_extra *vring_alloc_desc_extra(unsigned int num)
struct vring_desc_extra *desc_extra;
unsigned int i;
desc_extra = kmalloc_objs(struct vring_desc_extra, num, GFP_KERNEL);
desc_extra = kmalloc_objs(struct vring_desc_extra, num);
if (!desc_extra)
return NULL;
@@ -2449,7 +2449,7 @@ static int vring_alloc_state_extra_packed(struct vring_virtqueue_packed *vring_p
struct vring_desc_extra *extra;
u32 num = vring_packed->vring.num;
state = kmalloc_objs(struct vring_desc_state_packed, num, GFP_KERNEL);
state = kmalloc_objs(struct vring_desc_state_packed, num);
if (!state)
goto err_desc_state;
@@ -2528,7 +2528,7 @@ static struct virtqueue *__vring_new_virtqueue_packed(unsigned int index,
struct vring_virtqueue *vq;
int err;
vq = kmalloc_obj(*vq, GFP_KERNEL);
vq = kmalloc_obj(*vq);
if (!vq)
return NULL;

View File

@@ -287,7 +287,7 @@ create_affinity_masks(unsigned int nvecs, struct irq_affinity *affd)
if (!affvecs)
return NULL;
masks = kzalloc_objs(*masks, nvecs, GFP_KERNEL);
masks = kzalloc_objs(*masks, nvecs);
if (!masks)
return NULL;
@@ -462,7 +462,7 @@ static int virtio_vdpa_probe(struct vdpa_device *vdpa)
struct virtio_vdpa_device *vd_dev, *reg_dev = NULL;
int ret = -EINVAL;
vd_dev = kzalloc_obj(*vd_dev, GFP_KERNEL);
vd_dev = kzalloc_obj(*vd_dev);
if (!vd_dev)
return -ENOMEM;