[lvc-project] [PATCH v2] hwmon: (asus-ec-sensors) add WARN_ONCE() on invalid sensor index
Guenter Roeck
linux at roeck-us.net
Mon Apr 28 10:33:44 MSK 2025
On 4/28/25 00:11, Eugene Shalygin wrote:
> On Fri, 25 Apr 2025 at 22:00, Alexei Safin <a.safin at rosa.ru> wrote:
>>
>> Prevent undefined behavior by adding WARN_ONCE() when find_ec_sensor_index()
>> returns a negative value.
>
> I'm not sure about WARN_ONCE, does it bring anything useful? Clients
> see the error in the return value, sensor reading is absent, do we
> need to duplicate that in the log? Guenter, may I leave it up to you,
> please?
>
If this is seen, it is an implementation error which needs to be fixed.
Returning an error to userspace will leave users annoyed but will not
result in a fix. The warning backtrace is warranted in this situation.
Guenter
More information about the lvc-project
mailing list