From: Hao-Qun Huang <alvinhuang0603@gmail.com>
To: Dan Carpenter <error27@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Viresh Kumar <vireshk@kernel.org>,
Johan Hovold <johan@kernel.org>, Alex Elder <elder@kernel.org>,
greybus-dev@lists.linaro.org, linux-staging@lists.linux.dev,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: greybus: hid: fix SET_REPORT return value
Date: Fri, 10 Jul 2026 12:40:50 +0800 [thread overview]
Message-ID: <20260710124050.31335.alvinhuang0603@gmail.com> (raw)
In-Reply-To: <ak_tgJC8-d1HPKuV@stanley.mountain>
On Jul 10, 2026 at 2:50 AM, Dan Carpenter <error27@gmail.com> wrote:
> The bug is not hard to understand, the issue is that this changes the
> function completely... Was nothing checking the return before?
It gets checked. The value flows unchanged through __hid_hw_raw_request()
to the callers, and they look at it two ways:
- hidraw returns it straight to userspace (write(), HIDIOCSFEATURE),
where it is the number of bytes transferred.
- in-kernel SET_REPORT callers, some testing "ret < 0" (hid-multitouch,
hid-sony), some testing "ret != size" (hid-gt683r, hid-lenovo,
hid-razer).
So the old return 0 was wrong both ways: the first group had a failed
SET_REPORT masked as success, and the second saw every SET_REPORT as a
failure. Returning the count or a negative errno is what GET already
does in this driver and what usbhid/i2c-hid/uhid return, so nothing
working with those relied on the 0.
Thanks,
Hao-Qun
next prev parent reply other threads:[~2026-07-10 4:41 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2026-07-10 7:42 ` Dan Carpenter
2026-07-11 7:29 ` Hao-Qun Huang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260710124050.31335.alvinhuang0603@gmail.com \
--to=alvinhuang0603@gmail.com \
--cc=elder@kernel.org \
--cc=error27@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=greybus-dev@lists.linaro.org \
--cc=johan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=vireshk@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.