]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
Input: gameport - use sizeof(*pointer) instead of sizeof(type)
authorErick Archer <erick.archer@outlook.com>
Fri, 7 Jun 2024 17:17:55 +0000 (19:17 +0200)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Fri, 7 Jun 2024 18:59:41 +0000 (11:59 -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/PAXPR02MB72483F512F863C74A4AECA2B8BFB2@PAXPR02MB7248.eurprd02.prod.outlook.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/gameport/emu10k1-gp.c
drivers/input/gameport/fm801-gp.c
drivers/input/gameport/gameport.c
drivers/input/gameport/ns558.c

index 76ce41e58df0c78742c95098e88831750dbc3247..4f4583048f247d63c291e4b54d01165f658f4609 100644 (file)
@@ -43,7 +43,7 @@ static int emu_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
        struct gameport *port;
        int error;
 
-       emu = kzalloc(sizeof(struct emu), GFP_KERNEL);
+       emu = kzalloc(sizeof(*emu), GFP_KERNEL);
        port = gameport_allocate_port();
        if (!emu || !port) {
                printk(KERN_ERR "emu10k1-gp: Memory allocation failed\n");
index e785d36b19267b80532ed70ccd97ede335d0eeb3..7ae5009385cc0ede92e1c68a0a38c1ba0f13ca6c 100644 (file)
@@ -68,7 +68,7 @@ static int fm801_gp_probe(struct pci_dev *pci, const struct pci_device_id *id)
        struct gameport *port;
        int error;
 
-       gp = kzalloc(sizeof(struct fm801_gp), GFP_KERNEL);
+       gp = kzalloc(sizeof(*gp), GFP_KERNEL);
        port = gameport_allocate_port();
        if (!gp || !port) {
                printk(KERN_ERR "fm801-gp: Memory allocation failed\n");
index cfcc81c47b50f5b70a28c629dd71e72caeeca1c6..ad39ac6fa96d86d0254384581edeeb01e0ec36a2 100644 (file)
@@ -372,7 +372,7 @@ static int gameport_queue_event(void *object, struct module *owner,
                }
        }
 
-       event = kmalloc(sizeof(struct gameport_event), GFP_ATOMIC);
+       event = kmalloc(sizeof(*event), GFP_ATOMIC);
        if (!event) {
                pr_err("Not enough memory to queue event %d\n", event_type);
                retval = -ENOMEM;
index 91a8cd346e9b763d1b730ba2dc83260eb7c1db11..880e714b49bc96ba3f558787a148424989f4a38b 100644 (file)
@@ -120,7 +120,7 @@ static int ns558_isa_probe(int io)
                        return -EBUSY;
        }
 
-       ns558 = kzalloc(sizeof(struct ns558), GFP_KERNEL);
+       ns558 = kzalloc(sizeof(*ns558), GFP_KERNEL);
        port = gameport_allocate_port();
        if (!ns558 || !port) {
                printk(KERN_ERR "ns558: Memory allocation failed.\n");
@@ -192,7 +192,7 @@ static int ns558_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *did)
        if (!request_region(ioport, iolen, "ns558-pnp"))
                return -EBUSY;
 
-       ns558 = kzalloc(sizeof(struct ns558), GFP_KERNEL);
+       ns558 = kzalloc(sizeof(*ns558), GFP_KERNEL);
        port = gameport_allocate_port();
        if (!ns558 || !port) {
                printk(KERN_ERR "ns558: Memory allocation failed\n");