Input: keyboard - use sizeof(*pointer) instead of sizeof(type)
authorErick Archer <erick.archer@outlook.com>
Mon, 3 Jun 2024 04:29:43 +0000 (21:29 -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/AS8PR02MB7237277464F23CA168BFB3B18BF52@AS8PR02MB7237.eurprd02.prod.outlook.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/keyboard/atkbd.c
drivers/input/keyboard/lkkbd.c
drivers/input/keyboard/locomokbd.c
drivers/input/keyboard/maple_keyb.c
drivers/input/keyboard/newtonkbd.c
drivers/input/keyboard/stowaway.c
drivers/input/keyboard/sunkbd.c
drivers/input/keyboard/xtkbd.c

index 7f67f9f..f4f2078 100644 (file)
@@ -1279,7 +1279,7 @@ static int atkbd_connect(struct serio *serio, struct serio_driver *drv)
        struct input_dev *dev;
        int err = -ENOMEM;
 
-       atkbd = kzalloc(sizeof(struct atkbd), GFP_KERNEL);
+       atkbd = kzalloc(sizeof(*atkbd), GFP_KERNEL);
        dev = input_allocate_device();
        if (!atkbd || !dev)
                goto fail1;
index 047b654..c035216 100644 (file)
@@ -608,7 +608,7 @@ static int lkkbd_connect(struct serio *serio, struct serio_driver *drv)
        int i;
        int err;
 
-       lk = kzalloc(sizeof(struct lkkbd), GFP_KERNEL);
+       lk = kzalloc(sizeof(*lk), GFP_KERNEL);
        input_dev = input_allocate_device();
        if (!lk || !input_dev) {
                err = -ENOMEM;
index f866c03..4b0f832 100644 (file)
@@ -227,7 +227,7 @@ static int locomokbd_probe(struct locomo_dev *dev)
        struct input_dev *input_dev;
        int i, err;
 
-       locomokbd = kzalloc(sizeof(struct locomokbd), GFP_KERNEL);
+       locomokbd = kzalloc(sizeof(*locomokbd), GFP_KERNEL);
        input_dev = input_allocate_device();
        if (!locomokbd || !input_dev) {
                err = -ENOMEM;
index d08b565..91a1d29 100644 (file)
@@ -154,7 +154,7 @@ static int probe_maple_kbd(struct device *dev)
        mdev = to_maple_dev(dev);
        mdrv = to_maple_driver(dev->driver);
 
-       kbd = kzalloc(sizeof(struct dc_kbd), GFP_KERNEL);
+       kbd = kzalloc(sizeof(*kbd), GFP_KERNEL);
        if (!kbd) {
                error = -ENOMEM;
                goto fail;
index df00a11..71e0a3f 100644 (file)
@@ -68,7 +68,7 @@ static int nkbd_connect(struct serio *serio, struct serio_driver *drv)
        int err = -ENOMEM;
        int i;
 
-       nkbd = kzalloc(sizeof(struct nkbd), GFP_KERNEL);
+       nkbd = kzalloc(sizeof(*nkbd), GFP_KERNEL);
        input_dev = input_allocate_device();
        if (!nkbd || !input_dev)
                goto fail1;
index 56e7849..7ef0b3f 100644 (file)
@@ -72,7 +72,7 @@ static int skbd_connect(struct serio *serio, struct serio_driver *drv)
        int err = -ENOMEM;
        int i;
 
-       skbd = kzalloc(sizeof(struct skbd), GFP_KERNEL);
+       skbd = kzalloc(sizeof(*skbd), GFP_KERNEL);
        input_dev = input_allocate_device();
        if (!skbd || !input_dev)
                goto fail1;
index b123a20..72fb460 100644 (file)
@@ -263,7 +263,7 @@ static int sunkbd_connect(struct serio *serio, struct serio_driver *drv)
        int err = -ENOMEM;
        int i;
 
-       sunkbd = kzalloc(sizeof(struct sunkbd), GFP_KERNEL);
+       sunkbd = kzalloc(sizeof(*sunkbd), GFP_KERNEL);
        input_dev = input_allocate_device();
        if (!sunkbd || !input_dev)
                goto fail1;
index c9d7c24..befa713 100644 (file)
@@ -70,7 +70,7 @@ static int xtkbd_connect(struct serio *serio, struct serio_driver *drv)
        int err = -ENOMEM;
        int i;
 
-       xtkbd = kmalloc(sizeof(struct xtkbd), GFP_KERNEL);
+       xtkbd = kmalloc(sizeof(*xtkbd), GFP_KERNEL);
        input_dev = input_allocate_device();
        if (!xtkbd || !input_dev)
                goto fail1;