[lvc-project] [PATCH v2] hwmon: (asus-ec-sensors) add WARN_ONCE() on invalid sensor index

Eugene Shalygin eugene.shalygin at gmail.com
Thu May 1 15:44:48 MSK 2025


On Thu, 1 May 2025 at 14:34, Guenter Roeck <linux at roeck-us.net> wrote:

> You do have an excellent point, though: The messages should display the
> sensor type and channel. As for logging it every time: No, because _if_
> there is a programming error it would clog the log, so once is enough
> to tell "something is wrong with the code, fix it". The same is actually
> true if the hardware changes "under the hood".

But WARM_ONCE() can not behave the way we want, as far as I
understand, printing a single warning for each sensor type and
channel, can it?

> Regarding RAM errors: Those won't be caught by checks like this. You'd have
> to litter the whole kernel with checks at almost every line of code
> to even have a remote chance to catch problems like bit flips. Even
> then you'd still not catch cases where the code itself is changed.
> Even trying to catch that would be futile.

I already had a bug report (race condition in this driver, another log
message in the code) that kept me puzzled until the user reported that
it was caused by a malfunctioning RAM module.

Eugene



More information about the lvc-project mailing list