Input: misc - use sizeof(*pointer) instead of sizeof(type)
authorErick Archer <erick.archer@outlook.com>
Mon, 3 Jun 2024 04:26:14 +0000 (21:26 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Mon, 3 Jun 2024 04:32:01 +0000 (21:32 -0700)
It is preferred to use sizeof(*pointer) instead of sizeof(type)
due to the type of the variable can change and one needs not
change the former (unlike the latter). This patch has no effect
on runtime behavior.

Signed-off-by: Erick Archer <erick.archer@outlook.com>
Link: https://lore.kernel.org/r/AS8PR02MB7237884EB989EFF55D1BEF8B8BFE2@AS8PR02MB7237.eurprd02.prod.outlook.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/misc/88pm80x_onkey.c
drivers/input/misc/cma3000_d0x.c
drivers/input/misc/ims-pcu.c
drivers/input/misc/max8997_haptic.c
drivers/input/misc/pcap_keys.c
drivers/input/misc/powermate.c
drivers/input/misc/uinput.c
drivers/input/misc/yealink.c

index 4b0685f9611389a6e5de313179b08458a53b9ebd..6477a41c4bac3e0265f9c2b4aba129318e1242b4 100644 (file)
@@ -57,7 +57,7 @@ static int pm80x_onkey_probe(struct platform_device *pdev)
        struct pm80x_onkey_info *info;
        int err;
 
-       info = kzalloc(sizeof(struct pm80x_onkey_info), GFP_KERNEL);
+       info = kzalloc(sizeof(*info), GFP_KERNEL);
        if (!info)
                return -ENOMEM;
 
index 1772846708d28db948201cff745daadd2f0ee05a..0c68e924a1ccdc1dc11279fe37ad6ba86f189aeb 100644 (file)
@@ -292,7 +292,7 @@ struct cma3000_accl_data *cma3000_init(struct device *dev, int irq,
                goto err_out;
        }
 
-       data = kzalloc(sizeof(struct cma3000_accl_data), GFP_KERNEL);
+       data = kzalloc(sizeof(*data), GFP_KERNEL);
        input_dev = input_allocate_device();
        if (!data || !input_dev) {
                error = -ENOMEM;
index 80d16c92a08b3b0264935b70bf48f7c3d2e8ba02..408a586f8c360c845d7572ab32ae27ddd91b81e4 100644 (file)
@@ -287,7 +287,7 @@ static int ims_pcu_setup_gamepad(struct ims_pcu *pcu)
        struct input_dev *input;
        int error;
 
-       gamepad = kzalloc(sizeof(struct ims_pcu_gamepad), GFP_KERNEL);
+       gamepad = kzalloc(sizeof(*gamepad), GFP_KERNEL);
        input = input_allocate_device();
        if (!gamepad || !input) {
                dev_err(pcu->dev,
@@ -1993,7 +1993,7 @@ static int ims_pcu_probe(struct usb_interface *intf,
        struct ims_pcu *pcu;
        int error;
 
-       pcu = kzalloc(sizeof(struct ims_pcu), GFP_KERNEL);
+       pcu = kzalloc(sizeof(*pcu), GFP_KERNEL);
        if (!pcu)
                return -ENOMEM;
 
index 8861a67be5754a067372813600d271363ca27698..11cac4b7dddc08e1fbf9aeec134f8fddccc4c2b6 100644 (file)
@@ -249,7 +249,7 @@ static int max8997_haptic_probe(struct platform_device *pdev)
                return -EINVAL;
        }
 
-       chip = kzalloc(sizeof(struct max8997_haptic), GFP_KERNEL);
+       chip = kzalloc(sizeof(*chip), GFP_KERNEL);
        input_dev = input_allocate_device();
        if (!chip || !input_dev) {
                dev_err(&pdev->dev, "unable to allocate memory\n");
index 8a7e9ada59526a64842082254661094cb86d4981..f8954a2cab24d1d993531b01fbc8919b03e1bcba 100644 (file)
@@ -49,7 +49,7 @@ static int pcap_keys_probe(struct platform_device *pdev)
        struct pcap_keys *pcap_keys;
        struct input_dev *input_dev;
 
-       pcap_keys = kmalloc(sizeof(struct pcap_keys), GFP_KERNEL);
+       pcap_keys = kmalloc(sizeof(*pcap_keys), GFP_KERNEL);
        if (!pcap_keys)
                return err;
 
index db2ba89adaefa624f47e7ad7e24d366e411d6d36..4b039abffc4b85ae6c9e53f9a1f7b819c4a25565 100644 (file)
@@ -320,7 +320,7 @@ static int powermate_probe(struct usb_interface *intf, const struct usb_device_i
                0, interface->desc.bInterfaceNumber, NULL, 0,
                USB_CTRL_SET_TIMEOUT);
 
-       pm = kzalloc(sizeof(struct powermate_device), GFP_KERNEL);
+       pm = kzalloc(sizeof(*pm), GFP_KERNEL);
        input_dev = input_allocate_device();
        if (!pm || !input_dev)
                goto fail1;
index d98212d55108c7e394c669d08f6ea86859e1dfe9..d23f3225b00ff7bd7c8a1c7d4ce6fd4ae33d128b 100644 (file)
@@ -379,7 +379,7 @@ static int uinput_open(struct inode *inode, struct file *file)
 {
        struct uinput_device *newdev;
 
-       newdev = kzalloc(sizeof(struct uinput_device), GFP_KERNEL);
+       newdev = kzalloc(sizeof(*newdev), GFP_KERNEL);
        if (!newdev)
                return -ENOMEM;
 
index 69420781db300cc606e10656369cef217e8f3ec5..c3221b960a75a9223d95d4d8650c0f3db8cb4e2e 100644 (file)
@@ -868,7 +868,7 @@ static int usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
        if (!usb_endpoint_is_int_in(endpoint))
                return -ENODEV;
 
-       yld = kzalloc(sizeof(struct yealink_dev), GFP_KERNEL);
+       yld = kzalloc(sizeof(*yld), GFP_KERNEL);
        if (!yld)
                return -ENOMEM;