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

xiaoxiang 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 60df0cd6da Fix compile error.
60df0cd6da is described below

commit 60df0cd6da402271962421f5115d697c97512dd5
Author: wangzhi16 <[email protected]>
AuthorDate: Fri Jan 24 10:57:49 2025 +0800

    Fix compile error.
    
    CC: socket/listen.c chip/lpc17_40_i2c.c: In function 
'lpc17_40_i2cbus_initialize': chip/lpc17_40_i2c.c:534:29: warning: 'priv' is 
used uninitialized [-Wuninitialized]
    534 | flags = spin_lock_irqsave(&priv->spinlock);
    | ^~~~~~~~~~~~~~~
    chip/lpc17_40_i2c.c:529:29: note: 'priv' was declared here
    529 | struct lpc17_40_i2cdev_s *priv;
    | ^~~~
    
    Signed-off-by: wangzhi16 <[email protected]>
---
 arch/arm/src/lpc17xx_40xx/lpc17_40_i2c.c | 6 ------
 arch/arm/src/lpc43xx/lpc43_i2c.c         | 6 ------
 arch/arm/src/lpc54xx/lpc54_i2c_master.c  | 6 ------
 3 files changed, 18 deletions(-)

diff --git a/arch/arm/src/lpc17xx_40xx/lpc17_40_i2c.c 
b/arch/arm/src/lpc17xx_40xx/lpc17_40_i2c.c
index 5b65332917..b64a290dfa 100644
--- a/arch/arm/src/lpc17xx_40xx/lpc17_40_i2c.c
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_i2c.c
@@ -528,11 +528,8 @@ struct i2c_master_s *lpc17_40_i2cbus_initialize(int port)
 {
   struct lpc17_40_i2cdev_s *priv;
 
-  irqstate_t flags;
   uint32_t regval;
 
-  flags = spin_lock_irqsave(&priv->spinlock);
-
 #ifdef CONFIG_LPC17_40_I2C0
   if (port == 0)
     {
@@ -621,13 +618,10 @@ struct i2c_master_s *lpc17_40_i2cbus_initialize(int port)
   else
 #endif
     {
-      spin_unlock_irqrestore(&priv->spinlock, flags);
       i2cerr("ERROR: LPC I2C Only supports ports 0, 1 and 2\n");
       return NULL;
     }
 
-  spin_unlock_irqrestore(&priv->spinlock, flags);
-
   putreg32(I2C_CONSET_I2EN, priv->base + LPC17_40_I2C_CONSET_OFFSET);
 
   /* Attach Interrupt Handler */
diff --git a/arch/arm/src/lpc43xx/lpc43_i2c.c b/arch/arm/src/lpc43xx/lpc43_i2c.c
index 8d1c8a478e..25a0a62e18 100644
--- a/arch/arm/src/lpc43xx/lpc43_i2c.c
+++ b/arch/arm/src/lpc43xx/lpc43_i2c.c
@@ -459,11 +459,8 @@ struct i2c_master_s *lpc43_i2cbus_initialize(int port)
       return NULL;
     }
 
-  irqstate_t flags;
   uint32_t regval;
 
-  flags = spin_lock_irqsave(&priv->spinlock);
-
 #ifdef CONFIG_LPC43_I2C0
   if (port == 0)
     {
@@ -523,12 +520,9 @@ struct i2c_master_s *lpc43_i2cbus_initialize(int port)
   else
 #endif
     {
-      spin_unlock_irqrestore(&priv->spinlock, flags);
       return NULL;
     }
 
-  spin_unlock_irqrestore(&priv->spinlock, flags);
-
   putreg32(I2C_CONSET_I2EN, priv->base + LPC43_I2C_CONSET_OFFSET);
 
   /* Attach Interrupt Handler */
diff --git a/arch/arm/src/lpc54xx/lpc54_i2c_master.c 
b/arch/arm/src/lpc54xx/lpc54_i2c_master.c
index ead84fadfc..815d9d444e 100644
--- a/arch/arm/src/lpc54xx/lpc54_i2c_master.c
+++ b/arch/arm/src/lpc54xx/lpc54_i2c_master.c
@@ -909,13 +909,10 @@ static int lpc54_i2c_reset(struct i2c_master_s *dev)
 struct i2c_master_s *lpc54_i2cbus_initialize(int port)
 {
   struct lpc54_i2cdev_s *priv;
-  irqstate_t flags;
   uint32_t regval;
 
   i2cinfo("port=%d\n", port);
 
-  flags = spin_lock_irqsave(&priv->spinlock);
-
   /* Configure the requestin I2C peripheral */
 
   /* NOTE:  The basic FLEXCOMM initialization was performed in
@@ -1263,13 +1260,10 @@ struct i2c_master_s *lpc54_i2cbus_initialize(int port)
   else
 #endif
     {
-      spin_unlock_irqrestore(&priv->spinlock, flags);
       i2cerr("ERROR: Unsupported port=%d\n", port);
       return NULL;
     }
 
-  spin_unlock_irqrestore(&priv->spinlock, flags);
-
   /* Install our operations */
 
   priv->dev.ops = &lpc54_i2c_ops;

Reply via email to