All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Denis Benato" <denis.benato@linux.dev>
Cc: linux-input@vger.kernel.org, dmitry.torokhov@gmail.com
Subject: Re: [PATCH v2 08/12] HID: asus: add support for response curve
Date: Wed, 19 Aug 2026 20:17:09 +0000	[thread overview]
Message-ID: <20260819201709.8795B1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260819195835.1649657-9-denis.benato@linux.dev>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Inconsistent capability check for response curve sysfs read operations.
--

--- Patch [8]: [PATCH v2 08/12] HID: asus: add support for response curve ---
commit 64bba5ccd81bdede00727b014f07c871c53e11d2
Author: Denis Benato <denis.benato@linux.dev>

HID: asus: add support for response curve

This commit adds the ability for userspace to modify the response curve of
both joysticks on ROG ally devices by exposing relevant sysfs attributes.

> diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
> index 050d979f4315d..6f43b7317168f 100644
> --- a/drivers/hid/hid-asus.c
> +++ b/drivers/hid/hid-asus.c

[ ... ]

> +static ssize_t response_curve_pct_show(struct device *dev,
> +				       char *buf,
> +				       struct ally_config *cfg, bool is_left,
> +				       unsigned int idx)
> +{
> +	struct ally_joystick_resp_curve *curve;
> +	int ret = -EINVAL;
> +
> +	scoped_guard(mutex, &cfg->config_mutex) {
> +		curve = is_left ? &cfg->left_curve : &cfg->right_curve;
> +
> +		switch (idx) {

[Severity: Medium]
Should there be a capability check here before returning values?

The corresponding store operations check for !cfg->resp_curve_support and
return -EOPNOTSUPP, but this show function unconditionally returns the locally
initialized defaults (0, 33, 66, 100) even if the device doesn't support
response curves. Can this cause userspace feature-detection logic to
erroneously believe response curves are supported until a write fails?

> +		case 1:
> +			ret = sysfs_emit(buf, "%u\n", curve->entry_1.resp);
> +			break;
> +		case 2:
> +			ret = sysfs_emit(buf, "%u\n", curve->entry_2.resp);
> +			break;

[ ... ]

> +static ssize_t response_curve_move_show(struct device *dev,
> +					char *buf,
> +					struct ally_config *cfg, bool is_left,
> +					unsigned int idx)
> +{
> +	struct ally_joystick_resp_curve *curve;
> +	int ret = -EINVAL;
> +
> +	scoped_guard(mutex, &cfg->config_mutex) {
> +		curve = is_left ? &cfg->left_curve : &cfg->right_curve;
> +
> +		switch (idx) {

[Severity: Medium]
Similarly, should this show function also check !cfg->resp_curve_support
before returning values?

> +		case 1:
> +			ret = sysfs_emit(buf, "%u\n", curve->entry_1.move);
> +			break;
> +		case 2:

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260819195835.1649657-1-denis.benato@linux.dev?part=8

  reply	other threads:[~2026-08-19 20:17 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-19 19:58 [PATCH v2 00/12] HID: asus: add support for ROG Ally handhelds Denis Benato
2026-08-19 19:58 ` [PATCH v2 01/12] HID: asus: reinitialize the device after exiting a sleep state Denis Benato
2026-08-19 19:58 ` [PATCH v2 02/12] HID: asus: add support for ROG Ally handhelds Denis Benato
2026-08-19 20:11   ` sashiko-bot
2026-08-19 19:58 ` [PATCH v2 03/12] HID: asus: add gamepad configuration Denis Benato
2026-08-19 20:10   ` sashiko-bot
2026-08-19 19:58 ` [PATCH v2 04/12] HID: asus: add vibration strength configuration Denis Benato
2026-08-19 20:12   ` sashiko-bot
2026-08-19 19:58 ` [PATCH v2 05/12] HID: asus: add joysticks inner and outer range configuration Denis Benato
2026-08-19 20:15   ` sashiko-bot
2026-08-19 19:58 ` [PATCH v2 06/12] HID: asus: add triggers " Denis Benato
2026-08-19 19:58 ` [PATCH v2 07/12] HID: asus: add joysticks anti-deadzone configuration Denis Benato
2026-08-19 19:58 ` [PATCH v2 08/12] HID: asus: add support for response curve Denis Benato
2026-08-19 20:17   ` sashiko-bot [this message]
2026-08-19 19:58 ` [PATCH v2 09/12] HID: asus: add support to force feedback Denis Benato
2026-08-19 20:12   ` sashiko-bot
2026-08-19 19:58 ` [PATCH v2 10/12] HID: asus: add support for gamepad mode Denis Benato
2026-08-19 19:58 ` [PATCH v2 11/12] HID: asus: add support for turbo buttons Denis Benato
2026-08-19 20:23   ` sashiko-bot
2026-08-19 19:58 ` [PATCH v2 12/12] HID: asus: add support for btn remapping Denis Benato
2026-08-19 20:22   ` sashiko-bot

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=20260819201709.8795B1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=denis.benato@linux.dev \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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.