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 01/12] HID: asus: reinitialize the device after exiting a sleep state
Date: Thu, 13 Aug 2026 14:55:07 +0000	[thread overview]
Message-ID: <20260813145508.2EFED1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260813144736.2477941-2-denis.benato@linux.dev>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The newly added error handling blocks in `asus_probe()` and `asus_reset_resume()` are completely dead code because `asus_initialize_reports()` unconditionally returns 0.
--

--- Patch [1]: [PATCH 01/12] HID: asus: reinitialize the device after exiting a sleep state ---
commit 0ca493a924cc77202a10af1860055debe0b725bc
Author: Denis Benato <denis.benato@linux.dev>

HID: asus: reinitialize the device after exiting a sleep state

This patch extracts keyboard initialization into a helper function and
calls it during reset resume, ensuring devices like the ROG ally have
their EC string sent back after s2idle.

> diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
> --- a/drivers/hid/hid-asus.c
> +++ b/drivers/hid/hid-asus.c

[ ... ]

> @@ -1360,6 +1360,22 @@ static int asus_start_multitouch(struct hid_device *hdev)
>  	return 0;
>  }
>  
> +static int asus_initialize_reports(struct hid_device *hdev)
> +{
> +	int ret;
> +
> +	for (int r = 0; r < ARRAY_SIZE(asus_report_id_init); r++) {
> +		if (asus_has_report_id(hdev, asus_report_id_init[r])) {
> +			ret = asus_kbd_init(hdev, asus_report_id_init[r]);
> +			if (ret < 0)
> +				hid_warn(hdev, "Failed to initialize 0x%x: %d.\n",
> +					 asus_report_id_init[r], ret);
> +		}
> +	}
> +
> +	return 0;
> +}

[Severity: Low]
Does this helper function need to return the error code? 

Because it unconditionally returns 0, the error codes captured in the ret
variable from asus_kbd_init() are dropped after the warning is printed.

>  static int __maybe_unused asus_reset_resume(struct hid_device *hdev)
>  {
>  	struct asus_drvdata *drvdata = hid_get_drvdata(hdev);
> +	int ret;
> +
> +	ret = asus_initialize_reports(hdev);
> +	if (ret) {
> +		hid_err(hdev, "Asus initialize reports failed: %d\n", ret);
> +		goto asus_reset_resume_err;
> +	}

[Severity: Low]
Since asus_initialize_reports() unconditionally returns 0, does that make
this error path dead code? 

If the intent was to abort on initialization failure, should the helper return
the error code instead?

[ ... ]

> @@ -1493,13 +1518,10 @@ static int asus_probe(struct hid_device *hdev, const struct hid_device_id *id)
>  		return ret;
>  	}
>  
> -	for (int r = 0; r < ARRAY_SIZE(asus_report_id_init); r++) {
> -		if (asus_has_report_id(hdev, asus_report_id_init[r])) {
> -			ret = asus_kbd_init(hdev, asus_report_id_init[r]);
> -			if (ret < 0)
> -				hid_warn(hdev, "Failed to initialize 0x%x: %d.\n",
> -					 asus_report_id_init[r], ret);
> -		}
> +	ret = asus_initialize_reports(hdev);
> +	if (ret) {
> +		hid_err(hdev, "Asus initialize reports failed: %d\n", ret);
> +		goto err_stop_hw;
>  	}

[Severity: Low]
Similar to the check in asus_reset_resume(), is this error handling reachable?

The original code in asus_probe() only printed a warning on failure and
continued, so returning 0 preserves the old behavior, but it leaves this new
goto err_stop_hw path inaccessible.

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

  reply	other threads:[~2026-08-13 14:55 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-13 14:47 [PATCH 00/12] HID: asus: add support for ROG Ally handhelds Denis Benato
2026-08-13 14:47 ` [PATCH 01/12] HID: asus: reinitialize the device after exiting a sleep state Denis Benato
2026-08-13 14:55   ` sashiko-bot [this message]
2026-08-13 14:47 ` [PATCH 02/12] HID: asus: add support for ROG Ally handhelds Denis Benato
2026-08-13 15:00   ` sashiko-bot
2026-08-13 14:47 ` [PATCH 03/12] HID: asus: add gamepad configuration Denis Benato
2026-08-13 14:59   ` sashiko-bot
2026-08-13 14:47 ` [PATCH 04/12] HID: asus: add vibration strength configuration Denis Benato
2026-08-13 14:56   ` sashiko-bot
2026-08-13 14:47 ` [PATCH 05/12] HID: asus: add joysticks inner and outer range configuration Denis Benato
2026-08-13 15:02   ` sashiko-bot
2026-08-13 14:47 ` [PATCH 06/12] HID: asus: add triggers " Denis Benato
2026-08-13 14:58   ` sashiko-bot
2026-08-13 14:47 ` [PATCH 07/12] HID: asus: add joysticks anti-deadzone configuration Denis Benato
2026-08-13 15:02   ` sashiko-bot
2026-08-13 14:47 ` [PATCH 08/12] HID: asus: add support for response curve Denis Benato
2026-08-13 14:59   ` sashiko-bot
2026-08-13 14:47 ` [PATCH 09/12] HID: asus: add support to force feedback Denis Benato
2026-08-13 15:10   ` sashiko-bot
2026-08-13 14:47 ` [PATCH 10/12] HID: asus: add support for gamepad mode Denis Benato
2026-08-13 15:10   ` sashiko-bot
2026-08-13 14:47 ` [PATCH 11/12] HID: asus: add support for turbo buttons Denis Benato
2026-08-13 15:10   ` sashiko-bot
2026-08-13 14:47 ` [PATCH 12/12] HID: asus: add support for btn remapping Denis Benato
2026-08-13 15:12   ` 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=20260813145508.2EFED1F00A3A@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.