Re: [PATCH] staging: nvec: kbd: use -EINVAL instead of -1

From: Dan Carpenter

Date: Mon Mar 02 2026 - 04:29:56 EST


On Sun, Mar 01, 2026 at 01:50:08AM +0530, Soham Kute wrote:
> Return proper error code -EINVAL instead of -1 when
> the event type or code is not supported.
>
> Signed-off-by: Soham Kute <officialsohamkute@xxxxxxxxx>
> ---

Could you do some analysis to see if this affects runtime? You'll need
to review the callers to see what they do with error codes. In this
case they ignore them.

One thing which could help would be to build the Smatch cross function
DB. But it takes a long time so do it overnight.
https://github.com/error27/smatch
https://github.com/error27/smatch/blob/master/Documentation/smatch.rst
cd ~/path/to/kernel_dir ~/path/to/smatch_dir/smatch_scripts/build_kernel_data.sh

$ ~/progs/smatch/devel/smatch_data/db/smdb.py nvec_kbd_event | grep INTER
drivers/input/input.c | input_event_dispose | (struct input_dev)->event | INTERNAL | -1 | | int(*)(struct input_dev*, uint, uint, int)
drivers/input/input.c | input_dev_toggle | (struct input_dev)->event | INTERNAL | -1 | | int(*)(struct input_dev*, uint, uint, int)
drivers/input/input.c | input_dev_toggle | (struct input_dev)->event | INTERNAL | -1 | | int(*)(struct input_dev*, uint, uint, int)
drivers/input/input.c | input_dev_toggle | (struct input_dev)->event | INTERNAL | -1 | | int(*)(struct input_dev*, uint, uint, int)
drivers/input/input.c | input_dev_toggle | (struct input_dev)->event | INTERNAL | -1 | | int(*)(struct input_dev*, uint, uint, int)
drivers/hid/hid-holtek-kbd.c | holtek_kbd_input_event | (struct input_dev)->event | INTERNAL | -1 | | int(*)(struct input_dev*, uint, uint, int)
$

regards,
dan carpenter