Linux Input/HID development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Rong Zhang" <i@rong.moe>
Cc: linux-input@vger.kernel.org, dmitry.torokhov@gmail.com
Subject: Re: [PATCH v5 03/13] HID: haptic, multitouch: Check haptic prerequisite properly
Date: Sun, 29 Nov 2026 18:10:28 +0000	[thread overview]
Message-ID: <sashiko-outbox-239880@kernel.org> (raw)
In-Reply-To: <20261130-hid-haptic-kmod-v5-3-4903f73d8cac@rong.moe>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] HID: multitouch: inverted guard in mt_input_configured() skips
  haptic init
--

commit 9de6cdc8393811c21adee3b9cba77ef4b2490c87
Author: Rong Zhang <i@rong.moe>

HID: haptic, multitouch: Check haptic prerequisite properly

This commit tightens haptic touchpad prerequisite checks by validating that
all HID_DG_TIPPRESSURE usages share matching force units and annotations on a
single HID_DG_TOUCHPAD input device, and gates runtime haptic calls on the
matched input device.

> diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
> index f63d6f6550bd8..e017eff9b784f 100644
> --- a/drivers/hid/hid-multitouch.c
> +++ b/drivers/hid/hid-multitouch.c
[ ... ]
> @@ -1954,14 +1954,8 @@ static int mt_input_configured(struct hid_device *hdev, struct hid_input *hi)
>  	struct hid_report *report;
>  	int ret;
>  
> -	if (td->is_haptic_touchpad && (td->mtclass.name == MT_CLS_WIN_8 ||
> -	    td->mtclass.name == MT_CLS_WIN_8_FORCE_MULTI_INPUT ||
> -	    td->mtclass.name == MT_CLS_WIN_8_KEEP_LATENCY_ON_CLOSE)) {
> -		if (hid_haptic_input_configured(hdev, td->haptic, hi) == 0)
> -			td->is_haptic_touchpad = false;
> -	} else {
> -		td->is_haptic_touchpad = false;
> -	}
> +	if (!td->is_haptic_touchpad)
> +		td->is_haptic_touchpad = !hid_haptic_input_configured(hdev, td->haptic, hi);

[Severity: High]
Does the !td->is_haptic_touchpad check invert the condition and prevent
hid_haptic_input_configured() from initializing haptic touchpads?

During input mapping, mt_touch_input_mapping() already sets
td->is_haptic_touchpad from hid_haptic_check_pressure_unit():

drivers/hid/hid-multitouch.c:mt_touch_input_mapping() {
    ...
		case HID_DG_TIPPRESSURE:
			set_abs(hi->input, ABS_MT_PRESSURE, field,
				cls->sn_pressure);
			td->is_haptic_touchpad =
				hid_haptic_check_pressure_unit(td->haptic,
							       hi, field);
    ...
}

When hid_haptic_check_pressure_unit() succeeds and caches haptic->input_dev,
td->is_haptic_touchpad is already true on entry to mt_input_configured(), so
hid_haptic_input_configured() and hid_haptic_init() are skipped.  Conversely,
when td->is_haptic_touchpad is false on entry, haptic->input_dev is NULL or
ERR_PTR(-EPROTO), so hid_haptic_check_prerequisites() fails and
hid_haptic_init() is unreachable.  In addition, non-haptic touchpads that
report HID_DG_TIPPRESSURE in grams or newtons without haptic trigger reports
are never cleared by hid_haptic_check_prerequisites(), leaving
td->is_haptic_touchpad true on an uninitialized haptic device.

This call is later removed in commit "HID: haptic: Convert to a loadable
plugin module", but it breaks haptic initialization at this point in the
series and in stable backports of this commit.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261130-hid-haptic-kmod-v5-0-4903f73d8cac@rong.moe?part=3

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

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-29 17:52 [PATCH v5 00/13] HID: Add hid-plugin framework & convert hid-haptic into a generic plugin Rong Zhang
2026-11-29 17:52 ` [PATCH v5 01/13] HID: haptic: Get rid of input_ff_destroy() in error paths Rong Zhang
2026-11-29 17:52 ` [PATCH v5 02/13] HID: haptic: Fix use-after-free when draining workqueue Rong Zhang
2026-11-29 17:52 ` [PATCH v5 03/13] HID: haptic, multitouch: Check haptic prerequisite properly Rong Zhang
2026-11-29 18:10   ` sashiko-bot [this message]
2026-11-29 18:14     ` Rong Zhang
2026-11-29 18:19       ` Rong Zhang
2026-11-29 17:52 ` [PATCH v5 04/13] HID: haptic: Postpone GET_REPORT to init Rong Zhang
2026-11-29 17:52 ` [PATCH v5 05/13] HID: Add hid-plugin framework for loadable plugin modules Rong Zhang
2026-11-29 17:52 ` [PATCH v5 06/13] HID: haptic: Convert to a loadable plugin module Rong Zhang
2026-11-29 17:52 ` [PATCH v5 07/13] HID: haptic: Adopt pr_fmt, dev_fmt and hid_*() printk helpers Rong Zhang
2026-11-29 17:52 ` [PATCH v5 08/13] HID: Add Ordinal page defines Rong Zhang
2026-11-29 17:52 ` [PATCH v5 09/13] HID: haptic: Handle list reports separately and make auto trigger optional Rong Zhang
2026-11-29 17:52 ` [PATCH v5 10/13] HID: haptic: Decouple from hid-multitouch and support other devices Rong Zhang
2026-11-29 18:29   ` sashiko-bot
2026-11-29 17:52 ` [PATCH v5 11/13] HID: haptic: Add quirk table Rong Zhang
2026-11-29 17:52 ` [PATCH v5 12/13] HID: haptic: Add HID_HAPTIC_QUIRK_NO_RETRIGGER to disable retriggering Rong Zhang
2026-11-29 17:52 ` [PATCH v5 13/13] HID: haptic: Add quirk flag for Logitech MX Master 4 Rong Zhang

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-239880@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=i@rong.moe \
    --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