Linux Hardware Monitor development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Troy Mitchell" <troy.mitchell@linux.dev>
Cc: linux-hwmon@vger.kernel.org, robh@kernel.org,
	devicetree@vger.kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v2 6/6] riscv: dts: spacemit: Add CTF2301 on K3 CoM260
Date: Tue, 21 Jul 2026 10:00:05 +0000	[thread overview]
Message-ID: <20260721100005.B94D91F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260721-ctl2301-v2-6-ef5fb342872a@linux.dev>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] PWM duty cycle calculation can overflow and wrap around to 0, completely turning off the fan when maximum speed is requested.
--

--- Patch [6]: [PATCH v2 6/6] riscv: dts: spacemit: Add CTF2301 on K3 CoM260 ---
commit 2adeea2e46046fc26168a60ad26929de961f2f43
Author: Troy Mitchell <troy.mitchell@linux.dev>

riscv: dts: spacemit: Add CTF2301 on K3 CoM260

This commit enables I2C6 on the K3 CoM260 module. It sets the I2C6 pin power
source and describes the Sensylink CTF2301 temperature sensor and fan
controller.

> diff --git a/arch/riscv/boot/dts/spacemit/k3-com260.dtsi b/arch/riscv/boot/dts/spacemit/k3-com260.dtsi
> index a38d7b738258d..95a60fbb411f8 100644
> --- a/arch/riscv/boot/dts/spacemit/k3-com260.dtsi
> +++ b/arch/riscv/boot/dts/spacemit/k3-com260.dtsi
> @@ -26,6 +26,25 @@ reg_5v_sys: regulator-5v-sys {
>  	};
>  };
>  
> +&pinctrl {
> +	i2c6-1-cfg {
> +		i2c6-1-pins {
> +			power-source = <3300>;
> +		};
> +	};
> +};
> +
> +&i2c6 {
> +	pinctrl-names = "default";
> +	pinctrl-0 = <&i2c6_1_cfg>;
> +	status = "okay";
> +
> +	temperature-sensor@4c {
> +		compatible = "sensylink,ctf2301";

[Severity: High]
This isn't a bug introduced by this patch, but adding this sensor node
exposes a pre-existing PWM duty cycle calculation overflow in the lm63
driver.

When the fan controller computes the duty cycle in drivers/hwmon/lm63.c:

drivers/hwmon/lm63.c:lm63_pwm_to_reg() {
    ...
    return (val * data->pwm1_freq * 2 + LM63_MAX_PWM / 2) / LM63_MAX_PWM;
}

If the bootloader configures a low PWM frequency (setting the register > 127),
data->pwm1_freq will exceed 127 without bounds checking.

When maximum cooling is requested (val = 255), the arithmetic evaluates to
256 or more. Because the function returns a u8, the value implicitly
truncates and wraps around to 0.

Can this completely turn off the fan when maximum cooling is requested?

> +		reg = <0x4c>;
> +	};
> +};

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260721-ctl2301-v2-0-ef5fb342872a@linux.dev?part=6

      reply	other threads:[~2026-07-21 10:00 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-21  9:48 [PATCH v2 0/6] hwmon: (lm63) Add Sensylink CTF2301 support Troy Mitchell
2026-07-21  9:48 ` [PATCH v2 1/6] dt-bindings: vendor-prefixes: Add Sensylink Troy Mitchell
2026-07-21  9:51   ` sashiko-bot
2026-07-21 15:49   ` Conor Dooley
2026-07-21 17:56     ` Guenter Roeck
2026-07-21  9:48 ` [PATCH v2 2/6] dt-bindings: hwmon: Move LM63 family to a dedicated binding Troy Mitchell
2026-07-21  9:58   ` sashiko-bot
2026-07-21 11:38     ` Troy Mitchell
2026-07-21  9:48 ` [PATCH v2 3/6] dt-bindings: hwmon: Add Sensylink CTF2301 Troy Mitchell
2026-07-21  9:57   ` sashiko-bot
2026-07-21 15:46   ` Conor Dooley
2026-07-21  9:48 ` [PATCH v2 4/6] hwmon: (lm63) Add Sensylink CTF2301 support Troy Mitchell
2026-07-21 10:00   ` sashiko-bot
2026-07-21 11:52     ` Troy Mitchell
2026-07-21  9:48 ` [PATCH v2 5/6] riscv: dts: spacemit: Add K3 I2C6 pinctrl state Troy Mitchell
2026-07-21 10:00   ` sashiko-bot
2026-07-21 11:52     ` Troy Mitchell
2026-07-21  9:48 ` [PATCH v2 6/6] riscv: dts: spacemit: Add CTF2301 on K3 CoM260 Troy Mitchell
2026-07-21 10:00   ` sashiko-bot [this message]

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=20260721100005.B94D91F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=troy.mitchell@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