[PATCH] i2c: microchip-corei2c: disable clock after removing adapter

Jiawen Liu posted 1 patch 1 month, 1 week ago
[PATCH] i2c: microchip-corei2c: disable clock after removing adapter
Posted by Jiawen Liu 1 month, 1 week ago
From: jiawen <1298662399@qq.com>

In mchp_corei2c_remove(), the controller clock is disabled before
i2c_del_adapter() is called. This leaves the adapter teardown running
without the controller clock, which may be required for proper
operation. Reorder the calls to disable the clock after removing the
adapter, ensuring the adapter teardown runs while the clock is
available.

Signed-off-by: jiawen <1298662399@qq.com>
---
diff --git a/drivers/i2c/busses/i2c-microchip-corei2c.c b/drivers/i2c/busses/i2c-microchip-corei2c.c
--- a/drivers/i2c/busses/i2c-microchip-corei2c.c
+++ b/drivers/i2c/busses/i2c-microchip-corei2c.c
@@ -621,8 +621,8 @@
 {
 	struct mchp_corei2c_dev *idev = platform_get_drvdata(pdev);
 
+	i2c_del_adapter(&idev->adapter);
 	clk_disable_unprepare(idev->i2c_clk);
-	i2c_del_adapter(&idev->adapter);
 }
 
 static const struct of_device_id mchp_corei2c_of_match[] = {