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 v15 11/18] HID: asus: add support for turbo buttons
Date: Tue, 10 Nov 2026 02:10:59 +0000	[thread overview]
Message-ID: <sashiko-outbox-206031@kernel.org> (raw)
In-Reply-To: <20261110020036.112884-12-denis.benato@linux.dev>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] HID: asus: mix of cleanup helpers and goto in
  ally_create_button_attributes()
--

commit be0ac16d9e727b97dff90265fa1d63aeee90736b
Author: Denis Benato <denis.benato@linux.dev>

HID: asus: add support for turbo buttons

This commit adds sysfs attributes to configure per-button turbo and toggle
periods on ROG Ally devices and restores those parameters during device
initialization.

> diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
> index 3a149f54a6ac8..b5a1466d327bf 100644
> --- a/drivers/hid/hid-asus.c
> +++ b/drivers/hid/hid-asus.c
[ ... ]
> @@ -2144,8 +2223,261 @@ static const struct attribute_group ally_attr_groups[] = {
[ ... ]
> +static struct ally_btn_sysfs_entry *ally_create_button_attributes(struct hid_device *hdev)
> +{
> +	int i, ret;
> +
> +	scoped_guard(mutex, &ally_prefs.lock)
> +		if (!ally_prefs.turbo_support)
> +			return NULL;
> +
> +	struct ally_btn_sysfs_entry *entries __free(kfree) = kzalloc_objs(*entries, ALLY_BTN_MAX);
> +	if (!entries)
> +		return ERR_PTR(-ENOMEM);
> +
> +	for (i = 0; i < ALLY_BTN_MAX; i++) {
> +		entries[i].btn = i;
> +
> +		if (!ally_btn_param(i)) {
> +			hid_err(hdev, "Invalid button id %d for turbo attributes\n", i);
> +			ret = -EINVAL;
> +			goto ally_btn_err_cleanup;
> +		}
> +
> +		ally_btn_turbo_init_attrs(&entries[i]);
> +		entries[i].group.name = ally_button_names[i];
> +		entries[i].group.attrs = entries[i].attrs;
> +
> +		ret = sysfs_create_group(&hdev->dev.kobj, &entries[i].group);
> +		if (ret < 0) {
> +			hid_err(hdev, "Failed to create sysfs group for %s: %d\n",
> +				ally_button_names[i], ret);
> +			goto ally_btn_err_cleanup;
> +		}
> +	}
> +
> +	return no_free_ptr(entries);
> +
> +ally_btn_err_cleanup:
> +	while (i--)
> +		sysfs_remove_group(&hdev->dev.kobj, &entries[i].group);
> +
> +	return ERR_PTR(ret);
> +}

[Severity: Low]
This isn't a bug, but ally_create_button_attributes() mixes __free(kfree) on
entries with goto ally_btn_err_cleanup error unwinding, contrary to the
cleanup.h convention against mixing scope-based cleanup with goto labels in
the same function. Since ally_btn_err_cleanup already unwinds the sysfs
groups on failure, entries could be freed explicitly with kfree(entries) in
the error path instead of using __free(kfree) and no_free_ptr().

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

  reply	other threads:[~2026-11-10  2:10 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10  2:00 [PATCH v15 00/18] HID: asus: add support for ROG Ally handhelds Denis Benato
2026-11-10  2:00 ` [PATCH v15 01/18] HID: asus: size feature reports from the HID report descriptor Denis Benato
2026-11-10  2:24   ` sashiko-bot
2026-11-10  2:00 ` [PATCH v15 02/18] HID: asus: add support for ROG Ally handhelds Denis Benato
2026-11-10  2:26   ` sashiko-bot
2026-11-10  2:00 ` [PATCH v15 03/18] HID: asus: add gamepad configuration Denis Benato
2026-11-10  2:00 ` [PATCH v15 04/18] HID: asus: add vibration strength configuration Denis Benato
2026-11-10  2:00 ` [PATCH v15 05/18] HID: asus: add joysticks inner and outer range configuration Denis Benato
2026-11-10  2:00 ` [PATCH v15 06/18] HID: asus: add triggers " Denis Benato
2026-11-10  2:00 ` [PATCH v15 07/18] HID: asus: add joysticks anti-deadzone configuration Denis Benato
2026-11-10  2:00 ` [PATCH v15 08/18] HID: asus: add support for response curve Denis Benato
2026-11-10  2:00 ` [PATCH v15 09/18] HID: asus: add support to force feedback Denis Benato
2026-11-10  2:00 ` [PATCH v15 10/18] HID: asus: add support for gamepad mode Denis Benato
2026-11-10  2:00 ` [PATCH v15 11/18] HID: asus: add support for turbo buttons Denis Benato
2026-11-10  2:10   ` sashiko-bot [this message]
2026-11-10  2:00 ` [PATCH v15 12/18] HID: asus: add support for btn remapping Denis Benato
2026-11-10  2:17   ` sashiko-bot
2026-11-10  2:00 ` [PATCH v15 13/18] HID: asus: identify XG Mobile stations and bind the LED to the reported model Denis Benato
2026-11-10  2:00 ` [PATCH v15 14/18] HID: asus: expose XG Mobile identity and firmware information Denis Benato
2026-11-10  2:00 ` [PATCH v15 15/18] HID: asus: document ROG XG Mobile sysfs attributes Denis Benato
2026-11-10  2:00 ` [PATCH v15 16/18] HID: asus: document ROG Ally " Denis Benato
2026-11-10  2:00 ` [PATCH v15 17/18] platform/x86: asus-armoury: pick the eGPU activation from the reported GPU Denis Benato
2026-11-10  2:00 ` [PATCH v15 18/18] MAINTAINERS: add maintainer for the ASUS HID driver Denis Benato

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=sashiko-outbox-206031@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.