Re: [PATCH] staging: greybus: hid: fix SET_REPORT return value
From: Hao-Qun Huang
Date: Thu Jul 09 2026 - 14:09:45 EST
On Jul 9, 2026 at 6:52 PM, Dan Carpenter <error27@xxxxxxxxx> wrote:
> These kinds of changes require testing. How have you tested this
> change?
I compile-tested it (W=1, building gb-hid, greybus and hid together) and
traced the return path by hand. I don't have Greybus HID hardware and
couldn't find a working emulator (gbsim has been dead since Ara), so I
haven't run it on a live device.
The bug is that gb_hid_set_report() returns -errno on failure and len on
success, and __gb_hid_output_raw_report() computes that into ret (even
adding one back for the report ID byte) and then returns 0, discarding
it. So a successful hidraw write reports 0 bytes written and a failed
SET_REPORT looks like success. The GET path next to it already returns
the count, as do usbhid, i2c-hid and uhid, so callers already handle a
positive return and greybus HID was the only one returning 0.
Thanks,
Hao-Qun