From: sashiko-bot@kernel.org
To: "Christian Marangi" <ansuelsmth@gmail.com>
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v6 1/7] thermal/drivers: airoha: fix copy paste error on clamp_t low temp
Date: Thu, 02 Jul 2026 10:00:11 +0000 [thread overview]
Message-ID: <20260702100011.C7E021F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260702094846.17325-2-ansuelsmth@gmail.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [High] The driver fails to update or disable hardware trip point thresholds when the thermal framework clears the boundaries, causing continuous spurious interrupts.
- [High] The thermal IRQ handler silently drops valid thermal events if both high and low interrupt status bits are asserted simultaneously.
--
commit c9ebb221cc728a9aaa865333e7d5b41b485e09e1
Author: Christian Marangi <ansuelsmth@gmail.com>
thermal/drivers: airoha: fix copy paste error on clamp_t low temp
In airoha_thermal_set_trips, there is a copy paste error on clamping the
value for the low trip temp point. Fix it to the correct value and actually
clamp for the low variable.
> diff --git a/drivers/thermal/airoha_thermal.c b/drivers/thermal/airoha_thermal.c
> index b9fd6bfc88e5e..439aa011b75c7 100644
> --- a/drivers/thermal/airoha_thermal.c
> +++ b/drivers/thermal/airoha_thermal.c
> @@ -273,7 +273,7 @@ static int airoha_thermal_set_trips(struct thermal_zone_device *tz, int low,
>
> if (low != -INT_MAX) {
> /* Validate low and clamp it to a supported value */
> - low = clamp_t(int, high, RAW_TO_TEMP(priv, 0),
> + low = clamp_t(int, low, RAW_TO_TEMP(priv, 0),
> RAW_TO_TEMP(priv, FIELD_MAX(EN7581_DOUT_TADC_MASK)));
>
> /* We offset the low temp of 1°C to trigger correct event */
> writel(TEMP_TO_RAW(priv, low) >> 4,
> priv->base + EN7581_TEMPOFFSETL);
>
> enable_monitor = true;
> }
>
> /* Enable sensor 0 monitor after trip are set */
> if (enable_monitor)
> writel(EN7581_SENSE0_EN, priv->base + EN7581_TEMPMONCTL0);
>
> return 0;
> }
[Severity: High]
This is a pre-existing issue, but I noticed the hardware monitor thresholds
aren't disabled when the boundaries are cleared.
If the thermal framework passes INT_MAX for high and -INT_MAX for low
to clear active trip points, enable_monitor will be false, but there is no
code to write 0 to disable the hardware monitor.
Could this lead to spurious interrupts since the stale thresholds remain active?
Looking at airoha_thermal_irq() in the same file:
static irqreturn_t airoha_thermal_irq(int irq, void *data)
{
...
status = readl(priv->base + EN7581_TEMPMONINTSTS);
switch (status & (EN7581_HOFSINTSTS0 | EN7581_LOFSINTSTS0)) {
case EN7581_HOFSINTSTS0:
event = THERMAL_TRIP_VIOLATED;
update = true;
break;
case EN7581_LOFSINTSTS0:
event = THERMAL_EVENT_UNSPECIFIED;
update = true;
break;
default:
/* Should be impossible as we enable only these Interrupt */
break;
}
[Severity: High]
This isn't a bug introduced by this patch, but does this switch statement
silently drop events if both high and low interrupt status bits are asserted
simultaneously?
If status & (EN7581_HOFSINTSTS0 | EN7581_LOFSINTSTS0) results in both bits
being set, it will fall through to the default case and ignore the events.
Since the IRQ handler is a threaded IRQ, could scheduling delays allow both
bits to be latched before the thread executes and cause us to lose thermal
notifications?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260702094846.17325-1-ansuelsmth@gmail.com?part=1
next prev parent reply other threads:[~2026-07-02 10:00 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-02 9:48 [PATCH v6 0/7] thermal/drivers: airoha: Add support for AN7583 Christian Marangi
2026-07-02 9:48 ` [PATCH v6 1/7] thermal/drivers: airoha: fix copy paste error on clamp_t low temp Christian Marangi
2026-07-02 10:00 ` sashiko-bot [this message]
2026-07-02 9:48 ` [PATCH v6 2/7] thermal/drivers: airoha: fix copy paste error for sen internal Christian Marangi
2026-07-02 10:07 ` sashiko-bot
2026-07-02 9:48 ` [PATCH v6 3/7] thermal/drivers: airoha: Convert to regmap API Christian Marangi
2026-07-02 10:16 ` sashiko-bot
2026-07-02 9:48 ` [PATCH v6 4/7] thermal/drivers: airoha: Generalize probe function Christian Marangi
2026-07-02 10:35 ` sashiko-bot
2026-07-02 9:48 ` [PATCH v6 5/7] thermal/drivers: airoha: Generalize get_thermal_ADC and set_mux function Christian Marangi
2026-07-02 9:48 ` [PATCH v6 6/7] dt-bindings: arm: airoha: Add the chip-scu node for AN7583 SoC Christian Marangi
2026-07-02 10:48 ` sashiko-bot
2026-07-02 9:48 ` [PATCH v6 7/7] thermal/drivers: airoha: Add support for AN7583 Thermal Sensor Christian Marangi
2026-07-02 11:04 ` 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=20260702100011.C7E021F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=ansuelsmth@gmail.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=robh@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.