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

Jiawen Liu <[email protected]>
Newsgroups org.kernel.vger.linux-i2c,org.infradead.lists.linux-riscv,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
From: jiawen <[email protected]>

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 <[email protected]>
---
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[] = {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.