From: sashiko-bot@kernel.org
To: "Guenter Roeck" <linux@roeck-us.net>
Cc: linux-hwmon@vger.kernel.org
Subject: Re: [PATCH v2] hwmon: (corsair-psu) Fix linear11 calculation
Date: Tue, 04 Aug 2026 03:55:42 +0000 [thread overview]
Message-ID: <20260804035543.47AB41F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260804034811.2385506-1-linux@roeck-us.net>
> In corsairpsu_linear11_to_int(), the mantissa is extracted using bitwise
> operations and cast to s16 before being shifted left:
>
> static int corsairpsu_linear11_to_int(const u16 val, const int scale)
> {
> ...
> const int mant = (((s16)(val & 0x7ff)) << 5) >> 5;
> ...
> }
>
> Due to C integer promotion rules, the masked value (which is always
> positive) is promoted to a 32-bit integer before the left shift. As a
> result, the sign bit is never extended to bit 31 of the promoted integer.
>
> When the device hardware reports a negative temperature in Linear11 format
> [ ... ]
> retaining as much information as possible.
>
> Reported-by: Sashiko <sashiko-bot@kernel.org>
> Cc: Wilken Gottwalt <wilken.gottwalt@posteo.net>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260804034811.2385506-1-linux@roeck-us.net?part=1
next prev parent reply other threads:[~2026-08-04 3:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-04 3:48 [PATCH v2] hwmon: (corsair-psu) Fix linear11 calculation Guenter Roeck
2026-08-04 3:55 ` sashiko-bot [this message]
2026-08-06 15:34 ` Wilken Gottwalt
2026-08-06 15:52 ` Guenter Roeck
2026-08-06 15:56 ` Wilken Gottwalt
2026-08-06 16:28 ` Guenter Roeck
2026-08-06 16:42 ` Wilken Gottwalt
2026-08-06 18:04 ` Guenter Roeck
2026-08-06 18:28 ` Wilken Gottwalt
2026-08-06 19:15 ` Guenter Roeck
2026-08-07 4:26 ` Wilken Gottwalt
2026-08-07 5:36 ` 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=20260804035543.47AB41F000E9@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox