Re: [PATCH] iio: imu: fix unbalanced regulator_disable calls, when probe fails
From: David Lechner
Date: Sun Mar 08 2026 - 14:29:49 EST
The patch subject should include the specific driver so we know
what we are dealing with right away and to make it easy to search
for later.
iio: imu: inv_mpu6050: ...
On 3/8/26 6:03 AM, Andrey Skvortsov wrote:
> During a probe functions after all regulators are enabled, runtime pm
> is enabled. Before probe function finishes, runtime pm triggers and
> disables vddio regulator. When probe function fails after that,
> inv_mpu_core_disable_regulator_action tries to disable already
> disabled by runtime pm vddio regulator causing following backtrace:
This sounds like a similar issue to one we saw recently [1][2].
[1]: https://lore.kernel.org/all/20260205-inv-icm45600-fix-regulator-put-warning-v1-1-314ec12512cb@xxxxxxx/
[2]: https://lore.kernel.org/linux-iio/20260217-inv-icm45600-fix-regulator-put-warning-v2-1-08ad62b1dcdb@xxxxxxx/
...
>
> This change introduces variable to track state of vddio regulator and
> whether it's needed to disable it or not.
If we have to track the regulator enable state, it seems like the frameworks
are broken or we are using them wrong.
In the other similar patch, we moved the pm_runtime stuff around to make it
work. Could we do something like that here?
...
Also, tip for better commit messages: this last paragraph should go
first and use imperative form "Introduce a variable..." (don't say "This
change/patch/etc."). Then follow that with the explanation of why we
need the change.