diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2026-02-21 16:37:42 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2026-02-21 17:09:51 -0800 |
| commit | bf4afc53b77aeaa48b5409da5c8da6bb4eff7f43 (patch) | |
| tree | 01fdd9d27f1b272bef0127966e08eac44d134d0a /drivers/usb/core | |
| parent | e19e1b480ac73c3e62ffebbca1174f0f511f43e7 (diff) | |
| download | lwn-bf4afc53b77aeaa48b5409da5c8da6bb4eff7f43.tar.gz lwn-bf4afc53b77aeaa48b5409da5c8da6bb4eff7f43.zip | |
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>
Diffstat (limited to 'drivers/usb/core')
| -rw-r--r-- | drivers/usb/core/config.c | 4 | ||||
| -rw-r--r-- | drivers/usb/core/devio.c | 10 | ||||
| -rw-r--r-- | drivers/usb/core/driver.c | 2 | ||||
| -rw-r--r-- | drivers/usb/core/endpoint.c | 2 | ||||
| -rw-r--r-- | drivers/usb/core/hcd.c | 2 | ||||
| -rw-r--r-- | drivers/usb/core/hub.c | 12 | ||||
| -rw-r--r-- | drivers/usb/core/ledtrig-usbport.c | 4 | ||||
| -rw-r--r-- | drivers/usb/core/message.c | 2 | ||||
| -rw-r--r-- | drivers/usb/core/port.c | 4 | ||||
| -rw-r--r-- | drivers/usb/core/quirks.c | 2 | ||||
| -rw-r--r-- | drivers/usb/core/usb.c | 2 |
11 files changed, 23 insertions, 23 deletions
diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c index 129cbfd74f26..8e88ae8d0e71 100644 --- a/drivers/usb/core/config.c +++ b/drivers/usb/core/config.c @@ -1045,7 +1045,7 @@ int usb_get_bos_descriptor(struct usb_device *dev) return -ENOMSG; } - bos = kzalloc_obj(*bos, GFP_KERNEL); + bos = kzalloc_obj(*bos); if (!bos) return -ENOMEM; @@ -1066,7 +1066,7 @@ int usb_get_bos_descriptor(struct usb_device *dev) if (total_len < length) return -EINVAL; - dev->bos = kzalloc_obj(*dev->bos, GFP_KERNEL); + dev->bos = kzalloc_obj(*dev->bos); if (!dev->bos) return -ENOMEM; diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index d7ac181454f9..e191934623c7 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c @@ -245,7 +245,7 @@ static int usbdev_mmap(struct file *file, struct vm_area_struct *vma) if (ret) goto error; - usbm = kzalloc_obj(struct usb_memory, GFP_KERNEL); + usbm = kzalloc_obj(struct usb_memory); if (!usbm) { ret = -ENOMEM; goto error_decrease_mem; @@ -402,7 +402,7 @@ static struct async *alloc_async(unsigned int numisoframes) { struct async *as; - as = kzalloc_obj(struct async, GFP_KERNEL); + as = kzalloc_obj(struct async); if (!as) return NULL; as->urb = usb_alloc_urb(numisoframes, GFP_KERNEL); @@ -970,7 +970,7 @@ static int parse_usbdevfs_streams(struct usb_dev_state *ps, if (num_streams_ret && (num_streams < 2 || num_streams > 65536)) return -EINVAL; - eps = kmalloc_objs(*eps, num_eps, GFP_KERNEL); + eps = kmalloc_objs(*eps, num_eps); if (!eps) return -ENOMEM; @@ -1039,7 +1039,7 @@ static int usbdev_open(struct inode *inode, struct file *file) int ret; ret = -ENOMEM; - ps = kzalloc_obj(struct usb_dev_state, GFP_KERNEL); + ps = kzalloc_obj(struct usb_dev_state); if (!ps) goto out_free_ps; @@ -1670,7 +1670,7 @@ static int proc_do_submiturb(struct usb_dev_state *ps, struct usbdevfs_urb *uurb /* min 8 byte setup packet */ if (uurb->buffer_length < 8) return -EINVAL; - dr = kmalloc_obj(struct usb_ctrlrequest, GFP_KERNEL); + dr = kmalloc_obj(struct usb_ctrlrequest); if (!dr) return -ENOMEM; if (copy_from_user(dr, uurb->buffer, 8)) { diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index db67874879d8..2574e65bc640 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c @@ -57,7 +57,7 @@ ssize_t usb_store_new_id(struct usb_dynids *dynids, if (fields < 2) return -EINVAL; - dynid = kzalloc_obj(*dynid, GFP_KERNEL); + dynid = kzalloc_obj(*dynid); if (!dynid) return -ENOMEM; diff --git a/drivers/usb/core/endpoint.c b/drivers/usb/core/endpoint.c index f44f0fffeb41..4137ab47f1cd 100644 --- a/drivers/usb/core/endpoint.c +++ b/drivers/usb/core/endpoint.c @@ -154,7 +154,7 @@ int usb_create_ep_devs(struct device *parent, struct ep_device *ep_dev; int retval; - ep_dev = kzalloc_obj(*ep_dev, GFP_KERNEL); + ep_dev = kzalloc_obj(*ep_dev); if (!ep_dev) { retval = -ENOMEM; goto exit; diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index f1b2b0e4c437..c0e2fa2bd282 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c @@ -2193,7 +2193,7 @@ int ehset_single_step_set_feature(struct usb_hcd *hcd, int port) if (!buf) return -ENOMEM; - dr = kmalloc_obj(struct usb_ctrlrequest, GFP_KERNEL); + dr = kmalloc_obj(struct usb_ctrlrequest); if (!dr) { kfree(buf); return -ENOMEM; diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 22a54c632c26..24960ba9caa9 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -1461,20 +1461,20 @@ static int hub_configure(struct usb_hub *hub, unsigned full_load; unsigned maxchild; - hub->buffer = kmalloc_obj(*hub->buffer, GFP_KERNEL); + hub->buffer = kmalloc_obj(*hub->buffer); if (!hub->buffer) { ret = -ENOMEM; goto fail; } - hub->status = kmalloc_obj(*hub->status, GFP_KERNEL); + hub->status = kmalloc_obj(*hub->status); if (!hub->status) { ret = -ENOMEM; goto fail; } mutex_init(&hub->status_mutex); - hub->descriptor = kzalloc_obj(*hub->descriptor, GFP_KERNEL); + hub->descriptor = kzalloc_obj(*hub->descriptor); if (!hub->descriptor) { ret = -ENOMEM; goto fail; @@ -1522,7 +1522,7 @@ static int hub_configure(struct usb_hub *hub, dev_info(hub_dev, "%d port%s detected\n", maxchild, str_plural(maxchild)); - hub->ports = kzalloc_objs(struct usb_port *, maxchild, GFP_KERNEL); + hub->ports = kzalloc_objs(struct usb_port *, maxchild); if (!hub->ports) { ret = -ENOMEM; goto fail; @@ -1958,7 +1958,7 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id) /* We found a hub */ dev_info(&intf->dev, "USB hub found\n"); - hub = kzalloc_obj(*hub, GFP_KERNEL); + hub = kzalloc_obj(*hub); if (!hub) return -ENOMEM; @@ -5236,7 +5236,7 @@ check_highspeed(struct usb_hub *hub, struct usb_device *udev, int port1) if (udev->quirks & USB_QUIRK_DEVICE_QUALIFIER) return; - qual = kmalloc_obj(*qual, GFP_KERNEL); + qual = kmalloc_obj(*qual); if (qual == NULL) return; diff --git a/drivers/usb/core/ledtrig-usbport.c b/drivers/usb/core/ledtrig-usbport.c index e7de8864a527..8881644777a7 100644 --- a/drivers/usb/core/ledtrig-usbport.c +++ b/drivers/usb/core/ledtrig-usbport.c @@ -190,7 +190,7 @@ static int usbport_trig_add_port(struct usbport_trig_data *usbport_data, size_t len; int err; - port = kzalloc_obj(*port, GFP_KERNEL); + port = kzalloc_obj(*port); if (!port) { err = -ENOMEM; goto err_out; @@ -305,7 +305,7 @@ static int usbport_trig_activate(struct led_classdev *led_cdev) struct usbport_trig_data *usbport_data; int err; - usbport_data = kzalloc_obj(*usbport_data, GFP_KERNEL); + usbport_data = kzalloc_obj(*usbport_data); if (!usbport_data) return -ENOMEM; usbport_data->led_cdev = led_cdev; diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index d8f50d468794..ea970ddf8879 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c @@ -2287,7 +2287,7 @@ int usb_driver_set_configuration(struct usb_device *udev, int config) { struct set_config_request *req; - req = kmalloc_obj(*req, GFP_KERNEL); + req = kmalloc_obj(*req); if (!req) return -ENOMEM; req->udev = udev; diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c index 36096973eb59..44e38f922bc5 100644 --- a/drivers/usb/core/port.c +++ b/drivers/usb/core/port.c @@ -739,11 +739,11 @@ int usb_hub_create_port_device(struct usb_hub *hub, int port1) struct usb_device *hdev = hub->hdev; int retval; - port_dev = kzalloc_obj(*port_dev, GFP_KERNEL); + port_dev = kzalloc_obj(*port_dev); if (!port_dev) return -ENOMEM; - port_dev->req = kzalloc_obj(*(port_dev->req), GFP_KERNEL); + port_dev->req = kzalloc_obj(*(port_dev->req)); if (!port_dev->req) { kfree(port_dev); return -ENOMEM; diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c index 135a89ab2bfa..9e7e49712739 100644 --- a/drivers/usb/core/quirks.c +++ b/drivers/usb/core/quirks.c @@ -61,7 +61,7 @@ static int quirks_param_set(const char *value, const struct kernel_param *kp) quirk_list = NULL; } - quirk_list = kzalloc_objs(struct quirk_entry, quirk_count, GFP_KERNEL); + quirk_list = kzalloc_objs(struct quirk_entry, quirk_count); if (!quirk_list) { quirk_count = 0; mutex_unlock(&quirk_mutex); diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index cfb882b86981..e9a10a33534c 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c @@ -648,7 +648,7 @@ struct usb_device *usb_alloc_dev(struct usb_device *parent, struct usb_hcd *usb_hcd = bus_to_hcd(bus); unsigned raw_port = port1; - dev = kzalloc_obj(*dev, GFP_KERNEL); + dev = kzalloc_obj(*dev); if (!dev) return NULL; |
