The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] staging: greybus: hid: fix SET_REPORT return value
@ 2026-07-04  8:16 Hao-Qun Huang
  2026-07-09 10:52 ` Dan Carpenter
  0 siblings, 1 reply; 6+ messages in thread
From: Hao-Qun Huang @ 2026-07-04  8:16 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Viresh Kumar, Johan Hovold, Alex Elder, greybus-dev,
	linux-staging, linux-kernel, Hao-Qun Huang, stable

__gb_hid_output_raw_report() stores the result of gb_hid_set_report()
in ret and even adjusts it to account for the report ID byte, but then
always returns 0.

This hides Greybus transport errors from HID_REQ_SET_REPORT callers,
and makes hidraw report zero bytes written to user space on success,
although hid_hw_raw_request() is expected to return the number of
bytes transferred or a negative errno. The sibling GET_REPORT path,
__gb_hid_get_raw_report(), already follows this convention.

Return ret like the other HID transport drivers do.

Fixes: 96eab779e198 ("greybus: hid: add HID class driver")
Cc: stable@vger.kernel.org
Assisted-by: Claude:claude-fable-5
Signed-off-by: Hao-Qun Huang <alvinhuang0603@gmail.com>
---
diff --git a/drivers/staging/greybus/hid.c b/drivers/staging/greybus/hid.c
index f1f9f6fbc00e..1d7186eecd23 100644
--- a/drivers/staging/greybus/hid.c
+++ b/drivers/staging/greybus/hid.c
@@ -256,7 +256,7 @@ static int __gb_hid_output_raw_report(struct hid_device *hid, __u8 *buf,
 	if (report_id && ret >= 0)
 		ret++; /* add report_id to the number of transferred bytes */
 
-	return 0;
+	return ret;
 }
 
 static int gb_hid_raw_request(struct hid_device *hid, unsigned char reportnum,

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-07-10  7:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-04  8:16 [PATCH] staging: greybus: hid: fix SET_REPORT return value Hao-Qun Huang
2026-07-09 10:52 ` Dan Carpenter
2026-07-09 18:06   ` Hao-Qun Huang
2026-07-09 18:50     ` Dan Carpenter
2026-07-10  4:40       ` Hao-Qun Huang
2026-07-10  7:42         ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox