i2c-for-7.1-rc5

- core:
   - smbus: fix a potential uninitialization bug
 - tegra:
   - drop runtime PM reference when exiting on mutex_lock failure
   - preserve transfer errors when releasing the mutex
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEOZGx6rniZ1Gk92RdFA3kzBSgKbYFAmoRYoEACgkQFA3kzBSg
 Kbb1gA/+JYtgCLp8zwuQTdvSa9ajYf212JAtu2c51UYjZppwivvT6bFMNbHFh9Wh
 jR+st4yJ8ULL0PLurc7dl8q1D6gxoJ8fvtx6v9hyihLN9wHQ9NFV8r/QP11dVO8o
 vE4Ebb0OFHzH/B5P8r8ZdAY7Iq2fZ7IZPgDgeV+a9O02BShmn/y9/eJSw/V3tlbV
 pKjojcoZBRgKrmu6UVCCtXJRj07ZPSOWnl4Auc7SGrek7jwdLtL6Gg/lcdyWGLY1
 M4ZDAl8lnOYhnuknCD7JiK+cY2kM9I7VRROIcAbekqXFsx48M4Rz8xulhzaUJWpW
 /1QLyfeTSqyylEauRciXe8SaJ0ZvwogGRQEUaop/EPMAaQeARmxy8/Ez4mXt1rhI
 qkZTVF5D0KDlVYri0CMYjEFth7P2zMx8d7pMEb3JVIOhda+RBqVjMdTSSffkhzri
 MW8lXDzD/Ae431OVoW0IPF6hvZn2++/hO1eyJxNpQ0O8KLWK1hEp+8eIqB0VtEVy
 /AyBAgBEFBxC3kKyqDQlNVnQR/n0YUmE10/rN2Oa5IjnrBfhxG7BSSOatws+DdFe
 tNM8cUQf7Fk62I02LrxMSMnT1yjubMAVZoI68Sj5dX3vEAx+pyVTRRIv3mL9yPAb
 /XGgzYa2y7I/8IybHCb0BOzLAa3FW5MNWvz66CJB1ngfCFICscE=
 =zXRp
 -----END PGP SIGNATURE-----

Merge tag 'i2c-for-7.1-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux

Pull i2c fixes from Wolfram Sang:
 "Core:
   - smbus: fix a potential uninitialization bug

  Tegra:
   - drop runtime PM reference when exiting on mutex_lock failure
   - preserve transfer errors when releasing the mutex"

* tag 'i2c-for-7.1-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
  i2c: smbus: fix a potential uninitialization bug
  i2c: tegra: make tegra_i2c_mutex_unlock() return void
  i2c: tegra: fix pm_runtime leak on mutex_lock failure
This commit is contained in:
Linus Torvalds 2026-05-23 07:32:39 -07:00
commit 3f264650ca
2 changed files with 10 additions and 10 deletions

View File

@ -589,25 +589,22 @@ static int tegra_i2c_mutex_lock(struct tegra_i2c_dev *i2c_dev)
return ret;
}
static int tegra_i2c_mutex_unlock(struct tegra_i2c_dev *i2c_dev)
static void tegra_i2c_mutex_unlock(struct tegra_i2c_dev *i2c_dev)
{
unsigned int reg = i2c_dev->hw->regs->sw_mutex;
u32 val, id;
if (!i2c_dev->hw->has_mutex)
return 0;
return;
val = readl(i2c_dev->base + reg);
id = FIELD_GET(I2C_SW_MUTEX_GRANT, val);
if (id && id != I2C_SW_MUTEX_ID_CCPLEX) {
dev_warn(i2c_dev->dev, "unable to unlock mutex, mutex is owned by: %u\n", id);
return -EPERM;
}
if (WARN(id && id != I2C_SW_MUTEX_ID_CCPLEX,
"unable to unlock mutex, mutex is owned by: %u\n", id))
return;
writel(0, i2c_dev->base + reg);
return 0;
}
static void tegra_i2c_mask_irq(struct tegra_i2c_dev *i2c_dev, u32 mask)
@ -1666,8 +1663,10 @@ static int tegra_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[],
}
ret = tegra_i2c_mutex_lock(i2c_dev);
if (ret)
if (ret) {
pm_runtime_put(i2c_dev->dev);
return ret;
}
for (i = 0; i < num; i++) {
enum msg_end_type end_type = MSG_END_STOP;
@ -1698,7 +1697,7 @@ static int tegra_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[],
break;
}
ret = tegra_i2c_mutex_unlock(i2c_dev);
tegra_i2c_mutex_unlock(i2c_dev);
pm_runtime_put(i2c_dev->dev);
return ret ?: i;

View File

@ -353,6 +353,7 @@ static s32 i2c_smbus_xfer_emulated(struct i2c_adapter *adapter, u16 addr,
&& size != I2C_SMBUS_I2C_BLOCK_DATA);
msgbuf0[0] = command;
msgbuf1[0] = 0;
switch (size) {
case I2C_SMBUS_QUICK:
msg[0].len = 0;