summaryrefslogtreecommitdiffstats
path: root/drivers/input/touchscreen/fujitsu_ts.c
diff options
context:
space:
mode:
authorErick Archer <erick.archer@outlook.com>2024-06-08 16:34:49 +0200
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2024-06-09 23:38:38 +0200
commitf81d03d43965261056d963572d0335645008a8e8 (patch)
treea7bdc0045c86c059a48b3dc44de24d53a608df4b /drivers/input/touchscreen/fujitsu_ts.c
parentInput: cap11xx - stop using chip ID when configuring it (diff)
downloadlinux-f81d03d43965261056d963572d0335645008a8e8.tar.xz
linux-f81d03d43965261056d963572d0335645008a8e8.zip
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/fujitsu_ts.c')
-rw-r--r--drivers/input/touchscreen/fujitsu_ts.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/input/touchscreen/fujitsu_ts.c b/drivers/input/touchscreen/fujitsu_ts.c
index 3b0b8fccc3f0..1a3e14ea2e08 100644
--- a/drivers/input/touchscreen/fujitsu_ts.c
+++ b/drivers/input/touchscreen/fujitsu_ts.c
@@ -99,7 +99,7 @@ static int fujitsu_connect(struct serio *serio, struct serio_driver *drv)
struct input_dev *input_dev;
int err;
- fujitsu = kzalloc(sizeof(struct fujitsu), GFP_KERNEL);
+ fujitsu = kzalloc(sizeof(*fujitsu), GFP_KERNEL);
input_dev = input_allocate_device();
if (!fujitsu || !input_dev) {
err = -ENOMEM;