summaryrefslogtreecommitdiff
path: root/drivers/input/touchscreen/dynapro.c
diff options
context:
space:
mode:
authorErick Archer <erick.archer@outlook.com>2024-06-08 17:34:49 +0300
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2024-06-10 00:38:38 +0300
commitf81d03d43965261056d963572d0335645008a8e8 (patch)
treea7bdc0045c86c059a48b3dc44de24d53a608df4b /drivers/input/touchscreen/dynapro.c
parentf4c7fa7c058b9893b7a949cdb2f2aa504903f497 (diff)
downloadlinux-f81d03d43965261056d963572d0335645008a8e8.tar.xz
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>
Diffstat (limited to 'drivers/input/touchscreen/dynapro.c')
-rw-r--r--drivers/input/touchscreen/dynapro.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/input/touchscreen/dynapro.c b/drivers/input/touchscreen/dynapro.c
index dc07fca7c5ed..fe626a226b85 100644
--- a/drivers/input/touchscreen/dynapro.c
+++ b/drivers/input/touchscreen/dynapro.c
@@ -110,7 +110,7 @@ static int dynapro_connect(struct serio *serio, struct serio_driver *drv)
struct input_dev *input_dev;
int err;
- pdynapro = kzalloc(sizeof(struct dynapro), GFP_KERNEL);
+ pdynapro = kzalloc(sizeof(*pdynapro), GFP_KERNEL);
input_dev = input_allocate_device();
if (!pdynapro || !input_dev) {
err = -ENOMEM;