]> Gentwo Git Trees - linux/.git/commit
HID: cp2112: fix setter callbacks return value
authorSébastien Szymanski <sebastien.szymanski@armadeus.com>
Thu, 4 Sep 2025 16:42:07 +0000 (18:42 +0200)
committerJiri Kosina <jkosina@suse.com>
Fri, 12 Sep 2025 15:15:19 +0000 (17:15 +0200)
commit2a5e76b9a0efc44807ff0e6b141649fac65a55ac
tree18709abf995c00d10d841769e9d71e2383af5bea
parent8599049a96850ac96a64c0c6e5cfdec5b94d9207
HID: cp2112: fix setter callbacks return value

Since commit 6485543488a6 ("HID: cp2112: use new line value setter
callbacks"), setting a GPIO value always fails with error -EBADE.

That's because the returned value by the setter callbacks is the
returned value by the hid_hw_raw_request() function which is the number of
bytes sent on success or a negative value on error. The function
gpiochip_set() returns -EBADE if the setter callbacks return a value >
0.

Fix this by making the setter callbacks return 0 on success or a negative
value on error.

While at it, use the returned value by cp2112_gpio_set_unlocked() in the
direction_output callback.

Fixes: 6485543488a6 ("HID: cp2112: use new line value setter callbacks")
Signed-off-by: Sébastien Szymanski <sebastien.szymanski@armadeus.com>
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
drivers/hid/hid-cp2112.c