Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Troy Mitchell" <troy.mitchell@linux.dev>
Cc: robh@kernel.org, devicetree@vger.kernel.org, conor+dt@kernel.org,
	linux-hwmon@vger.kernel.org
Subject: Re: [PATCH v2 4/6] hwmon: (lm63) Add Sensylink CTF2301 support
Date: Tue, 21 Jul 2026 10:00:04 +0000	[thread overview]
Message-ID: <20260721100004.D93AC1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260721-ctl2301-v2-4-ef5fb342872a@linux.dev>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Unchecked I2C reads for LSB are bitwise-ORed into 16-bit register values, corrupting data on read errors.
--

--- Patch [4]: [PATCH v2 4/6] hwmon: (lm63) Add Sensylink CTF2301 support ---
commit bbf54143e45eb1b3b9599d60a55904a5184333c9
Author: Troy Mitchell <troy.mitchell@linux.dev>

hwmon: (lm63) Add Sensylink CTF2301 support

This commit adds support for the Sensylink CTF2301 chip to the lm63 driver.
It introduces extended local temperature resolution and optional thermal
cooling device registration.

> diff --git a/drivers/hwmon/lm63.c b/drivers/hwmon/lm63.c
> index e2a429e579ac1..764a7467afa60 100644
> --- a/drivers/hwmon/lm63.c
> +++ b/drivers/hwmon/lm63.c

[ ... ]

> @@ -256,8 +270,16 @@ static struct lm63_data *lm63_update_device(struct device *dev)
>  
>  		data->temp8[0] = i2c_smbus_read_byte_data(client,
>  				 LM63_REG_LOCAL_TEMP);
> +		if (data->kind == ctf2301)
> +			data->temp1_input = ((u16)(u8)data->temp8[0] << 8)
> +					  | i2c_smbus_read_byte_data(client,
> +						CTF2301_REG_LOCAL_TEMP_LSB);
>  		data->temp8[1] = i2c_smbus_read_byte_data(client,
>  				 LM63_REG_LOCAL_HIGH);
> +		if (data->kind == ctf2301)
> +			data->temp1_max = ((u16)(u8)data->temp8[1] << 8)
> +					  | i2c_smbus_read_byte_data(client,
> +						CTF2301_REG_LOCAL_HIGH_LSB);

[Severity: Medium]
Will this corrupt the temperature reading if the I2C read fails?

In lm63_update_device(), if i2c_smbus_read_byte_data() for the LSB returns
a negative error code (such as -EIO), it gets bitwise-ORed with the shifted
MSB. The negative s32 error code would sign-extend, overwriting the MSB
bits entirely and resulting in a large negative temperature spike instead
of propagating the error or maintaining the previous valid reading.

Could we check the return value of i2c_smbus_read_byte_data() before
merging it into temp1_input and temp1_max?

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

  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 [this message]
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

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=20260721100004.D93AC1F000E9@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