[PATCH v2 2/2] i2c: designware: Add disabling clocks when probe fails

Kunihiko Hayashi posted 2 patches 2 months, 2 weeks ago
[PATCH v2 2/2] i2c: designware: Add disabling clocks when probe fails
Posted by Kunihiko Hayashi 2 months, 2 weeks ago
After an error occurs during probing state, dw_i2c_plat_pm_cleanup() is
called. However, this function doesn't disable clocks and the clock-enable
count keeps increasing. Should disable these clocks explicitly.

Co-developed-by: Kohei Ito <ito.kohei@socionext.com>
Signed-off-by: Kohei Ito <ito.kohei@socionext.com>
Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
---
 drivers/i2c/busses/i2c-designware-platdrv.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index edaebfb165f9..f6424dcfdff6 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -308,6 +308,7 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
 
 exit_probe:
 	dw_i2c_plat_pm_cleanup(dev);
+	i2c_dw_prepare_clk(dev, false);
 exit_reset:
 	reset_control_assert(dev->rst);
 	return ret;
-- 
2.34.1
Re: [PATCH v2 2/2] i2c: designware: Add disabling clocks when probe fails
Posted by Wolfram Sang 1 week, 2 days ago
On Thu, Jul 24, 2025 at 01:22:11PM +0900, Kunihiko Hayashi wrote:
> After an error occurs during probing state, dw_i2c_plat_pm_cleanup() is
> called. However, this function doesn't disable clocks and the clock-enable
> count keeps increasing. Should disable these clocks explicitly.
> 
> Co-developed-by: Kohei Ito <ito.kohei@socionext.com>
> Signed-off-by: Kohei Ito <ito.kohei@socionext.com>
> Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
> Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>

Applied to for-next with the Fixes tag added, thanks!

Re: [PATCH v2 2/2] i2c: designware: Add disabling clocks when probe fails
Posted by Jarkko Nikula 2 months, 1 week ago
Hi

On 7/24/25 7:22 AM, Kunihiko Hayashi wrote:
> After an error occurs during probing state, dw_i2c_plat_pm_cleanup() is
> called. However, this function doesn't disable clocks and the clock-enable
> count keeps increasing. Should disable these clocks explicitly.
> 
> Co-developed-by: Kohei Ito <ito.kohei@socionext.com>
> Signed-off-by: Kohei Ito <ito.kohei@socionext.com>
> Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
> ---
>   drivers/i2c/busses/i2c-designware-platdrv.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
> index edaebfb165f9..f6424dcfdff6 100644
> --- a/drivers/i2c/busses/i2c-designware-platdrv.c
> +++ b/drivers/i2c/busses/i2c-designware-platdrv.c
> @@ -308,6 +308,7 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
>   
>   exit_probe:
>   	dw_i2c_plat_pm_cleanup(dev);
> +	i2c_dw_prepare_clk(dev, false);
>   exit_reset:
>   	reset_control_assert(dev->rst);
>   	return ret;

Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>