Re: [PATCH v6 2/2] input: misc: Add Qualcomm SPMI PMIC haptics driver

[email protected]
Newsgroups org.kernel.vger.linux-devicetree,org.kernel.vger.linux-input
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Haptic effect fails to stop if `stop_timeline` wraps around to exactly 0.
--

--- Patch [2]: [PATCH v6 2/2] input: misc: Add Qualcomm SPMI PMIC haptics driver ---
commit 21a083ab5b9214e43c2b8143306bc686c7af6e1b
Author: Fenglin Wu <[email protected]>

input: misc: Add Qualcomm SPMI PMIC haptics driver

This commit adds an initial driver for the Qualcomm PMIH0108 PMIC haptics
module. It supports DIRECT_PLAY and FIFO modes using the input
force-feedback framework.

> diff --git a/drivers/input/misc/qcom-spmi-haptics.c b/drivers/input/misc/qcom-spmi-haptics.c
> new file mode 100644
> --- /dev/null
> +++ b/drivers/input/misc/qcom-spmi-haptics.c
[ ... ]
> +static void haptics_stop_work(struct work_struct *work)
> +{
> +	struct qcom_haptics *h = container_of(to_delayed_work(work),
> +					      struct qcom_haptics, stop_work);
> +
> +	guard(mutex)(&h->play_lock);
> +
> +	if (h->active_effect_id != -1 && h->stop_timeline &&
> +	    time_after_eq(jiffies, h->stop_timeline))

[Severity: Medium]
Will this skip stopping the haptic effect if jiffies wraps around such that
the calculated stop_timeline is exactly 0?

Since 0 is a valid jiffies value, checking stop_timeline for truthiness
can result in the motor continuing to vibrate indefinitely if this exact
wraparound value is hit.

> +		haptics_stop(h, false);
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.