[PATCH] i2c: axxia: disable clock after removing adapter in remove

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

In axxia_i2c_remove, the controller clock is disabled before
i2c_del_adapter is called. This leaves adapter teardown running after
the hardware clock is off, which can cause undefined behavior or hangs.

Reorder the calls to disable the clock after removing the adapter,
ensuring the adapter is fully torn down while the clock is still
enabled.

Signed-off-by: jiawen <[email protected]>
---
diff --git a/drivers/i2c/busses/i2c-axxia.c b/drivers/i2c/busses/i2c-axxia.c
--- a/drivers/i2c/busses/i2c-axxia.c
+++ b/drivers/i2c/busses/i2c-axxia.c
@@ -795,8 +795,8 @@
 {
 	struct axxia_i2c_dev *idev = platform_get_drvdata(pdev);
 
+	i2c_del_adapter(&idev->adapter);
 	clk_disable_unprepare(idev->i2c_clk);
-	i2c_del_adapter(&idev->adapter);
 }
 
 /* Match table for of_platform binding */
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.