Re: [PATCH v7 1/3] hwmon: emc2305: Fix fan channel index handling

From: Guenter Roeck

Date: Thu Apr 30 2026 - 19:13:31 EST


On Wed, Apr 29, 2026 at 09:59:53AM +0300, florin.leotescu@xxxxxxxxxxx wrote:
> From: Florin Leotescu <florin.leotescu@xxxxxxx>
>
> The fan channel index is used to access per-channel data structures.
> Validate the index against the number of available channels
> before use to prevent out-of-bounds access if an invalid
> value is provided.
>
> The thermal registration path currently uses a sequential child index,
> which may not match the validated channel from DT. Use the DT "reg"
> property when registering cooling devices to ensure consistent
> channel handling
>
> Signed-off-by: Florin Leotescu <florin.leotescu@xxxxxxx>

The problems found by Sashiko are real, but they are pre-existing.
The locking issues are pre-existing, and data->pwm_separate is for
all practical purposes always false (there is no upstream user of
the platform data, so it may well be removed), meaning there is no
separation of pwm channels if the thermal subsystem is enabled.
Given that, applied.

Thanks,
Guenter