Re: [PATCH] hwmon: (corsair-cpro) Cache fan target only after a successful command

From: Guenter Roeck

Date: Sun Oct 25 2026 - 20:33:18 EST


On Wed, Oct 21, 2026 at 01:09:41AM +0900, Baek Kyu, Kim wrote:
> set_target() updates the cached fan target before sending the command.
> If the command fails, subsequent fanN_target reads report the failed
> request instead of the previous value. For example, after successfully
> setting 1200 RPM, a rejected request for 1800 RPM returns an error but
> leaves fanN_target reporting 1800. A failed request also replaces
> -ENODATA when no target has been successfully set.
>
> Update the target cache under the existing mutex only after
> send_usb_cmd() succeeds, as set_pwm() already does when invalidating
> the target. Preserve the previous cached value and return the original
> error on failure.
>
> Fixes: 40c3a4454225 ("hwmon: add Corsair Commander Pro driver")
> Signed-off-by: Baek Kyu, Kim <pocj8ur4in@xxxxxxxxx>

Applied.

Thanks,
Guenter