This is an automated email from the ASF dual-hosted git repository.

GUIDINGLI pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 70e453c2c4e [UPSTREAM] arch/arm/imxrt: Improve imxrt_lpi2c_reset
70e453c2c4e is described below

commit 70e453c2c4e1b85c5025aa0419dd066fc0fecb09
Author: Jukka Laitinen <[email protected]>
AuthorDate: Tue Sep 22 12:04:59 2026 +0300

    [UPSTREAM] arch/arm/imxrt: Improve imxrt_lpi2c_reset
    
    Re-initialize the bus even in the case the bus cannot be re-covered. The
    client still has a reference to the bus, and may try to access it again.
    If the bus is not initialized or the root clock is off, the access may
    cause a crash.
    
    Signed-off-by: Jukka Laitinen <[email protected]>
---
 arch/arm/src/imxrt/imxrt_lpi2c.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/arm/src/imxrt/imxrt_lpi2c.c b/arch/arm/src/imxrt/imxrt_lpi2c.c
index ce57103b962..7953de8557f 100644
--- a/arch/arm/src/imxrt/imxrt_lpi2c.c
+++ b/arch/arm/src/imxrt/imxrt_lpi2c.c
@@ -2387,6 +2387,10 @@ static int imxrt_lpi2c_reset(struct i2c_master_s *dev)
   imxrt_config_gpio(sda_gpio);
   imxrt_config_gpio(scl_gpio);
 
+  ret = OK;
+
+out:
+
   /* Re-init the port */
 
   imxrt_lpi2c_init(priv);
@@ -2394,9 +2398,6 @@ static int imxrt_lpi2c_reset(struct i2c_master_s *dev)
   /* Restore the frequency */
 
   imxrt_lpi2c_setclock(priv, frequency);
-  ret = OK;
-
-out:
 
   /* Release the port for reuse by other clients */
 

Reply via email to