All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Guenter Roeck" <linux@roeck-us.net>
Cc: linux-hwmon@vger.kernel.org
Subject: Re: [PATCH 2/2] hwmon: (sht4x) Fix return value from heater_enable_store()
Date: Fri, 21 Aug 2026 15:01:26 +0000	[thread overview]
Message-ID: <20260821150126.F19821F00A3F@smtp.kernel.org> (raw)
In-Reply-To: <20260821144916.2889031-2-linux@roeck-us.net>

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

Pre-existing issues:
- [High] Unit mismatch between jiffies and milliseconds in sht4x_read_values timeout calculation
--

--- Patch [2]: [PATCH 2/2] hwmon: (sht4x) Fix return value from heater_enable_store() ---
commit ffda8f58b43906bc1ea2253c2bf9b7981f601ded
Author: Guenter Roeck <linux@roeck-us.net>

hwmon: (sht4x) Fix return value from heater_enable_store()

The return value in heater_enable_store() causes an unexpected write
failure in user-space because it returns 0 instead of count. This signals
to VFS that no bytes were processed, leading to a busy retry loop.
Returning count fixes the problem.

> diff --git a/drivers/hwmon/sht4x.c b/drivers/hwmon/sht4x.c
> index 7a0dc2ed723d8..a97dda9e92dc5 100644
> --- a/drivers/hwmon/sht4x.c
> +++ b/drivers/hwmon/sht4x.c
> @@ -288,7 +288,7 @@ static ssize_t heater_enable_store(struct device *dev,
>  
>  	data->heating_complete = jiffies + msecs_to_jiffies(heating_time_bound);

[Severity: High]
This isn't a bug introduced by this patch, but while reviewing how
data->heating_complete is used, I noticed a unit mismatch in
sht4x_read_values().

In sht4x_read_values(), the code calculates the timeout like this:

	if (data->data_pending &&
	    time_before(jiffies, data->heating_complete + data->update_interval)) {
		data->data_pending = false;

Is data->update_interval expected to be in milliseconds here?

Since data->update_interval is added directly to data->heating_complete
(which is in jiffies) without using msecs_to_jiffies(), does this create a
distorted timeout window?

Could this cause the driver to return stale, artificially high temperature
data from the heater phase instead of taking a new ambient measurement?

>  	data->data_pending = true;
> -	return 0;
> +	return count;
>  }

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260821144916.2889031-1-linux@roeck-us.net?part=2

  reply	other threads:[~2026-08-21 15:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-21 14:49 [PATCH 1/2] hwmon: (sht4x) Add missing locks Guenter Roeck
2026-08-21 14:49 ` [PATCH 2/2] hwmon: (sht4x) Fix return value from heater_enable_store() Guenter Roeck
2026-08-21 15:01   ` sashiko-bot [this message]
2026-08-21 15:00 ` [PATCH 1/2] hwmon: (sht4x) Add missing locks 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=20260821150126.F19821F00A3F@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --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.