From: Guenter Roeck <linux@roeck-us.net>
To: Animesh Rai <animeshrai853@gmail.com>,
steve.glendinning@shawell.net, linux-hwmon@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] hwmon: emc2103: use min_t() for explicit type in fan target clamp
Date: Mon, 6 Jul 2026 09:51:30 -0700 [thread overview]
Message-ID: <34f8c1fb-e23f-41c8-9327-1646fb4ec84b@roeck-us.net> (raw)
In-Reply-To: <20260706162519.6087-1-animeshrai853@gmail.com>
On 7/6/26 09:25, Animesh Rai wrote:
> Using min() with an explicit cast on one operand is fragile. Replace
> with min_t(u16, ...) to make the intended comparison type explicit and
> avoid implicit type conversion.
>
Sorry, I have no idea what you are trying to fix here. Both parameters
are u16. There is nothing "fragile" about that.
Guenter
> Signed-off-by: Animesh Rai <animeshrai853@gmail.com>
> ---
> drivers/hwmon/emc2103.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/hwmon/emc2103.c b/drivers/hwmon/emc2103.c
> index 27dc149a3ed9..fbb1b4025eb7 100644
> --- a/drivers/hwmon/emc2103.c
> +++ b/drivers/hwmon/emc2103.c
> @@ -348,7 +348,7 @@ static ssize_t fan1_div_store(struct device *dev, struct device_attribute *da,
> /* update fan target if high byte is not disabled */
> if ((data->fan_target & 0x1fe0) != 0x1fe0) {
> u16 new_target = (data->fan_target * old_div) / new_div;
> - data->fan_target = min(new_target, (u16)0x1fff);
> + data->fan_target = min_t(u16, new_target, 0x1fff);
> write_fan_target_to_i2c(client, data->fan_target);
> }
>
next prev parent reply other threads:[~2026-07-06 16:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-06 16:25 Animesh Rai
2026-07-06 16:51 ` Guenter Roeck [this message]
2026-07-06 19:57 ` David Laight
2026-07-06 20:16 ` Animesh Rai
2026-07-06 20:29 ` 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=34f8c1fb-e23f-41c8-9327-1646fb4ec84b@roeck-us.net \
--to=linux@roeck-us.net \
--cc=animeshrai853@gmail.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=steve.glendinning@shawell.net \
/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
all inboxes | Powered by JetHome®