Linux Hardware Monitor development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Luiz Angelo Daros de Luca" <luizluca@gmail.com>
Cc: linux-hwmon@vger.kernel.org
Subject: Re: [hwmon PATCH v3 5/6] hwmon: (adt7470) Fix temperature alarm logic in hwmon_temp_read()
Date: Mon, 27 Jul 2026 03:44:38 +0000	[thread overview]
Message-ID: <20260727034440.2CA821F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260727-adt7470_thermalzone-v3-5-21424d550c3d@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The bitmask calculation `BIT(channel)` for temperature alarms incorrectly maps channels 7, 8, and 9 due to a discontinuity at bit 7.
--

--- Patch [5]: [hwmon PATCH v3 5/6] hwmon: (adt7470) Fix temperature alarm logic in hwmon_temp_read() ---
commit ab0ed15b014e653c238da0d91110d0699630d8f7
Author: Luiz Angelo Daros de Luca <luizluca@gmail.com>

hwmon: (adt7470) Fix temperature alarm logic in hwmon_temp_read()

This commit changes the temperature alarm read logic to use a bitmask based
on the channel index, attempting to fix an issue where the channel index
was previously interpreted directly as an alarm bitmask.

Link: https://lore.kernel.org/r/20260717211224.B9E291F000E9@smtp.kernel.org

> diff --git a/drivers/hwmon/adt7470.c b/drivers/hwmon/adt7470.c
> index a34635526aaa2..f1150f0fe2172 100644
> --- a/drivers/hwmon/adt7470.c
> +++ b/drivers/hwmon/adt7470.c
> @@ -569,7 +569,7 @@ static int adt7470_temp_read(struct device *dev, u32 attr, int channel, long *va
>  		*val = 1000 * data->temp_max[channel];
>  		break;
>  	case hwmon_temp_alarm:
> -		*val = !!(data->alarm & channel);
> +		*val = !!(data->alarm & BIT(channel));

[Severity: High]
Does this bitwise calculation map correctly for higher channel indexes?

If bit 7 of the alarm state is the Out-of-Limit (OOL) global flag, it
appears channel 7 will erroneously report the OOL flag instead of its actual
alarm state.

Could this also cause an off-by-one mapping for the remaining channels,
where channel 8 reports channel 7's alarm and channel 9 reports channel 8's
alarm?

>  		break;
>  	default:
>  		return -EOPNOTSUPP;

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260727-adt7470_thermalzone-v3-0-21424d550c3d@gmail.com?part=5

  reply	other threads:[~2026-07-27  3:44 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-27  3:34 [hwmon PATCH v3 0/6] hwmon: (adt7470): Multiple fixes Luiz Angelo Daros de Luca
2026-07-27  3:34 ` [hwmon PATCH v3 1/6] hwmon: (adt7470) Fix fans stuck in manual mode on I2C errors Luiz Angelo Daros de Luca
2026-07-27  3:49   ` sashiko-bot
2026-07-27  3:34 ` [hwmon PATCH v3 2/6] hwmon: (adt7470) Fix cache updated before hardware write on I2C error Luiz Angelo Daros de Luca
2026-07-27  3:50   ` sashiko-bot
2026-07-27  5:03     ` Luiz Angelo Daros de Luca
2026-07-27  3:34 ` [hwmon PATCH v3 3/6] hwmon: (adt7470) Fix busy-loop and I2C flooding in update thread Luiz Angelo Daros de Luca
2026-07-27  3:49   ` sashiko-bot
2026-07-27  3:34 ` [hwmon PATCH v3 4/6] hwmon: (adt7470) Fix swapped PWM3 and PWM4 auto mode masks Luiz Angelo Daros de Luca
2026-07-27  3:46   ` sashiko-bot
2026-07-27 14:27   ` Guenter Roeck
2026-07-27  3:34 ` [hwmon PATCH v3 5/6] hwmon: (adt7470) Fix temperature alarm logic in hwmon_temp_read() Luiz Angelo Daros de Luca
2026-07-27  3:44   ` sashiko-bot [this message]
2026-07-27  4:29     ` Luiz Angelo Daros de Luca
2026-07-27  3:34 ` [hwmon PATCH v3 6/6] hwmon: (adt7470) Use cached PWM frequency value Luiz Angelo Daros de Luca
2026-07-27  3:45   ` sashiko-bot
2026-07-27  5:10     ` Luiz Angelo Daros de Luca
2026-07-27 14:33   ` Guenter Roeck
2026-07-27  3:44 ` [hwmon PATCH v3 0/6] hwmon: (adt7470): Multiple fixes Luiz Angelo Daros de Luca
2026-07-27 14:33   ` Guenter Roeck

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=20260727034440.2CA821F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=luizluca@gmail.com \
    --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