Skip to content

Commit

Permalink
Fix compile error.
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
wangzhi-art committed Jan 24, 2025
1 parent f6b9a8f commit 3460091
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 15 deletions.
5 changes: 0 additions & 5 deletions arch/arm/src/lpc17xx_40xx/lpc17_40_i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -531,8 +531,6 @@ struct i2c_master_s *lpc17_40_i2cbus_initialize(int port)
irqstate_t flags;
uint32_t regval;

flags = spin_lock_irqsave(&priv->spinlock);

#ifdef CONFIG_LPC17_40_I2C0
if (port == 0)
{
Expand Down Expand Up @@ -621,13 +619,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 */
Expand Down
5 changes: 0 additions & 5 deletions arch/arm/src/lpc43xx/lpc43_i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -462,8 +462,6 @@ struct i2c_master_s *lpc43_i2cbus_initialize(int port)
irqstate_t flags;
uint32_t regval;

flags = spin_lock_irqsave(&priv->spinlock);

#ifdef CONFIG_LPC43_I2C0
if (port == 0)
{
Expand Down Expand Up @@ -523,12 +521,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 */
Expand Down
5 changes: 0 additions & 5 deletions arch/arm/src/lpc54xx/lpc54_i2c_master.c
Original file line number Diff line number Diff line change
Expand Up @@ -914,8 +914,6 @@ struct i2c_master_s *lpc54_i2cbus_initialize(int port)

i2cinfo("port=%d\n", port);

flags = spin_lock_irqsave(&priv->spinlock);

/* Configure the requestin I2C peripheral */

/* NOTE: The basic FLEXCOMM initialization was performed in
Expand Down Expand Up @@ -1263,13 +1261,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;
Expand Down

0 comments on commit 3460091

Please sign in to comment.