Input: touchscreen - use sizeof(*pointer) instead of sizeof(type)
authorErick Archer <erick.archer@outlook.com>
Sat, 8 Jun 2024 14:34:49 +0000 (16:34 +0200)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Sun, 9 Jun 2024 21:38:38 +0000 (14:38 -0700)
commitf81d03d43965261056d963572d0335645008a8e8
treea7bdc0045c86c059a48b3dc44de24d53a608df4b
parentf4c7fa7c058b9893b7a949cdb2f2aa504903f497
Input: touchscreen - use sizeof(*pointer) instead of sizeof(type)

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).

The refactoring is mostly trivial except for "usbtouchscreen.c"
file. Here, in the "mtouch_alloc" and "nexio_alloc" functions,
it is necessary to use a variable with a predefined type instead
of the "usbtouch->priv" variable (void * type). This way, the
"sizeof" operator can now know the correct size. Moreover, we
need to set the "usbtouch->priv" pointer after the memory
allocation since now the "kmalloc" return value is not assigned
directly.

This patch has no effect on runtime behavior.

Signed-off-by: Erick Archer <erick.archer@outlook.com>
Link: https://lore.kernel.org/r/AS8PR02MB723708364CC0DF2EAAFEE5968BC42@AS8PR02MB7237.eurprd02.prod.outlook.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
17 files changed:
drivers/input/touchscreen/da9052_tsi.c
drivers/input/touchscreen/dynapro.c
drivers/input/touchscreen/egalax_ts_serial.c
drivers/input/touchscreen/elo.c
drivers/input/touchscreen/fujitsu_ts.c
drivers/input/touchscreen/gunze.c
drivers/input/touchscreen/hampshire.c
drivers/input/touchscreen/inexio.c
drivers/input/touchscreen/mtouch.c
drivers/input/touchscreen/penmount.c
drivers/input/touchscreen/sur40.c
drivers/input/touchscreen/touchit213.c
drivers/input/touchscreen/touchright.c
drivers/input/touchscreen/touchwin.c
drivers/input/touchscreen/tsc40.c
drivers/input/touchscreen/usbtouchscreen.c
drivers/input/touchscreen/wacom_w8001.c