Instead of just documenting by comment, ensure locking per code. Signed-off-by: Alexander Stein <alexander.stein@xxxxxxxxxxxxxxx> --- drivers/hwmon/gpio-fan.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/hwmon/gpio-fan.c b/drivers/hwmon/gpio-fan.c index b779240328d59..322b161d5ca1f 100644 --- a/drivers/hwmon/gpio-fan.c +++ b/drivers/hwmon/gpio-fan.c @@ -124,9 +124,10 @@ static int __get_fan_ctrl(struct gpio_fan_data *fan_data) return ctrl_val; } -/* Must be called with fan_data->lock held, except during initialization. */ static void set_fan_speed(struct gpio_fan_data *fan_data, int speed_index) { + WARN_ON_ONCE(!mutex_is_locked(&fan_data->lock)); + if (fan_data->speed_index == speed_index) return; -- 2.34.1