usb: core: config: Change sizeof(struct ...) to sizeof(*...)
authorRobert Greener <rob@robgreener.com>
Fri, 1 Oct 2021 15:13:50 +0000 (16:13 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 6 Oct 2021 06:25:47 +0000 (08:25 +0200)
This fixes the following checkpatch.pl warnings:

drivers/usb/core/config.c:989: CHECK:ALLOC_SIZEOF_STRUCT: Prefer kzalloc(sizeof(*bos)...) over kzalloc(sizeof(struct usb_bos_descriptor)...)
drivers/usb/core/config.c:1010: CHECK:ALLOC_SIZEOF_STRUCT: Prefer kzalloc(sizeof(*dev->bos)...) over kzalloc(sizeof(struct usb_host_bos)...)

Signed-off-by: Robert Greener <rob@robgreener.com>
Link: https://lore.kernel.org/r/20211001151350.ijiexr3ebwvypmdd@shortbread
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/core/config.c

index b199eb65f378070cb7fd0a73cc42aa0f2900828e..16b1fd9dc60c959703368f330f75984763dddf93 100644 (file)
@@ -986,7 +986,7 @@ int usb_get_bos_descriptor(struct usb_device *dev)
        __u8 cap_type;
        int ret;
 
-       bos = kzalloc(sizeof(struct usb_bos_descriptor), GFP_KERNEL);
+       bos = kzalloc(sizeof(*bos), GFP_KERNEL);
        if (!bos)
                return -ENOMEM;
 
@@ -1007,7 +1007,7 @@ int usb_get_bos_descriptor(struct usb_device *dev)
        if (total_len < length)
                return -EINVAL;
 
-       dev->bos = kzalloc(sizeof(struct usb_host_bos), GFP_KERNEL);
+       dev->bos = kzalloc(sizeof(*dev->bos), GFP_KERNEL);
        if (!dev->bos)
                return -ENOMEM;