Re: [PATCH] iio: temperature: mcp9600: Bound thresholds before scaling

From: Joshua Crofts

Date: Mon Nov 09 2026 - 05:08:15 EST


On Mon, 9 Nov 2026 17:35:17 +0800
Zhu Jun <zhujun2@xxxxxxxxxxxxxxxxxxxx> wrote:

> From: zhujun <zhujun2@xxxxxxxxxxxxxxxxxxxx>
>
> mcp9600_write_thresh() multiplies the integer part by 1000000 before
> clamping to the supported temperature range. The multiplication can
> overflow int, so a request such as 3000 degrees can select the lower
> threshold instead of the upper threshold.
>
> Clamp the integer part to the hot-junction range before scaling. Keep
> the existing final clamp for fractional values and the narrower cold-
> junction range.
>
> Fixes: dea750f8015b ("iio: temperature: mcp9600: add threshold events support")

You're missing a Signed-off-by tag. Without it, your patch cannot be accepted.

--
Kind regards,
Joshua Crofts