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 4b0685f..6477a41 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 1772846..0c68e92 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 80d16c9..408a586 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 8861a67..11cac4b 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 8a7e9ad..f8954a2 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 db2ba89..4b039ab 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 d98212d..d23f322 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 6942078..c3221b9 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;