From: sashiko-bot@kernel.org
To: "Matías Martínez" <hello@matias.me>
Cc: linux-input@vger.kernel.org, dmitry.torokhov@gmail.com
Subject: Re: [PATCH v2] HID: ayaneo: Add AYANEO 3 detachable controller driver
Date: Mon, 24 Aug 2026 22:41:20 +0000 [thread overview]
Message-ID: <20260824224121.2C5601F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260824223103.93947-1-hello@matias.me>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] Missing initialization of the multicolor LED channel intensities results in the LED remaining off by default.
- [Medium] The `hw_pattern` implementation completely ignores the brightness requested in the pattern string.
--
--- Patch [1]: [PATCH v2] HID: ayaneo: Add AYANEO 3 detachable controller driver ---
commit e8a8ced2df93a1a83b6b165f28028f3d597aafea
Author: Matías Martínez <hello@matias.me>
HID: ayaneo: Add AYANEO 3 detachable controller driver
This commit adds a driver for the vendor interface of the AYANEO 3
detachable controller. It provides module identification, software eject,
and RGB control of the joystick rings as a multicolor LED class device.
> diff --git a/drivers/hid/hid-ayaneo.c b/drivers/hid/hid-ayaneo.c
> new file mode 100644
> --- /dev/null
> +++ b/drivers/hid/hid-ayaneo.c
[ ... ]
> @@ -359,25 +359,25 @@ static int aya3_pattern_set(struct led_classdev *cdev,
> struct led_pattern *pattern, u32 len, int repeat)
> {
> struct led_classdev_mc *mc = lcdev_to_mccdev(cdev);
> struct aya3 *aya = container_of(mc, struct aya3, mcled);
> int ret;
>
> if (len != 2 || pattern[0].brightness || !pattern[1].brightness)
> return -EINVAL;
>
> ret = mutex_lock_interruptible(&aya->lock);
> if (ret)
> return ret;
> aya->pulse = true;
> ret = aya3_send_config(aya, 0);
[Severity: Medium]
Will this hardware breathing pattern fail to activate if the LED is currently
turned off?
In aya3_pattern_set(), the requested brightness in pattern[1].brightness is
validated but never used to update aya->rgb. If the LED was previously off,
aya->rgb remains {0, 0, 0}.
When aya3_send_config() is called, it checks aya->rgb to determine the mode:
if (aya->rgb[0] || aya->rgb[1] || aya->rgb[2])
mode = aya->pulse ? AYA3_RGB_PULSE : AYA3_RGB_SOLID;
If aya->rgb is all zeros, the mode will remain AYA3_RGB_OFF instead of
AYA3_RGB_PULSE, silently ignoring the pattern request. Also, if the LED was
already on, it will pulse with the previous brightness instead of the
requested brightness.
> mutex_unlock(&aya->lock);
> return ret;
> }
[ ... ]
> @@ -389,17 +389,17 @@ static int aya3_register_led(struct aya3 *aya)
> {
> struct led_classdev *cdev = &aya->mcled.led_cdev;
>
> aya->subleds[0].color_index = LED_COLOR_ID_RED;
> aya->subleds[1].color_index = LED_COLOR_ID_GREEN;
> aya->subleds[2].color_index = LED_COLOR_ID_BLUE;
> aya->mcled.subled_info = aya->subleds;
> aya->mcled.num_colors = 3;
[Severity: Medium]
Is it intentional that the subled channel intensities are left uninitialized?
Because aya is allocated with devm_kzalloc(), the intensity fields in
aya->subleds are zero-initialized. When userspace sets the brightness,
aya3_led_set() calls led_mc_calc_color_components(), which multiplies the
requested brightness by each subled's intensity to calculate the final RGB
values.
Since the intensity is 0, the resulting color components will always be 0,
causing the LED to remain off by default when a brightness is requested.
Should the channel intensity fields be initialized here?
>
> cdev->name = devm_kasprintf(&aya->hdev->dev, GFP_KERNEL,
> "%s:rgb:joystick_rings",
> dev_name(&aya->hdev->dev));
> if (!cdev->name)
> return -ENOMEM;
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260824223103.93947-1-hello@matias.me?part=1
prev parent reply other threads:[~2026-08-24 22:41 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-24 21:50 [PATCH] HID: ayaneo: Add AYANEO 3 detachable controller driver Matías Martínez
2026-08-24 22:00 ` Antheas Kapenekakis
2026-08-24 22:25 ` Antheas Kapenekakis
2026-08-24 22:47 ` Matías Martínez
2026-08-24 23:23 ` Antheas Kapenekakis
2026-08-25 17:21 ` Matías Martínez
2026-08-24 22:01 ` sashiko-bot
2026-08-24 22:47 ` Matías Martínez
2026-08-24 22:31 ` [PATCH v2] " Matías Martínez
2026-08-24 22:41 ` sashiko-bot [this message]
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=20260824224121.2C5601F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=hello@matias.me \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).