Re: [PATCH] i2c: imx-lpi2c: release clocks on remove
From: Krzysztof Kozlowski
Date: Tue Sep 15 2026 - 07:24:45 EST
On 14/09/2026 11:07, Guangshuo Li wrote:
> lpi2c_imx_probe() prepares and enables the controller clocks before
> enabling runtime PM. After probe succeeds, clock management is handed
> over to the runtime PM callbacks.
>
> However, lpi2c_imx_remove() only disables runtime PM and autosuspend.
> It does not ensure that the device is active before teardown or drop
> the clock references acquired during probe.
>
> For platforms which do not require clock prepare/unprepare in the
> runtime PM callbacks, runtime suspend only disables the clocks, leaving
> the prepare references held for the lifetime of the driver. Since the
> remove path never unprepares them, these references are leaked when the
> driver is unbound.
>
> For platforms which prepare and unprepare clocks during runtime PM, an
> unbind while the device is still runtime active can similarly leave
> the clock prepare and enable references outstanding.
>
> Resume the device before disabling runtime PM so that the clocks are in
> a known enabled and prepared state. Then drop the temporary runtime PM
> reference and disable and unprepare the clocks during final teardown.
> Mark the device suspended after the hardware resources have been
> released.
>
> This issue was found by manual code inspection.
>
> Fixes: 13d6eb20fc79 ("i2c: imx-lpi2c: add runtime pm support")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Guangshuo Li <lgs201920130244@xxxxxxxxx>
Nothing improved, you again spammed with multiple independent patches so
maintainers would need to respond TO EACH one instead of to the thread.
Best regards,
Krzysztof