mirror of
https://kernel.googlesource.com/pub/scm/linux/kernel/git/stable/linux-stable.git
synced 2025-11-04 07:44:51 +10:00
i2c: xiic: xiic_xfer(): Fix runtime PM leak on error path
[ Upstream commitd663d93bb4] The xiic_xfer() function gets a runtime PM reference when the function is entered. This reference is released when the function is exited. There is currently one error path where the function exits directly, which leads to a leak of the runtime PM reference. Make sure that this error path also releases the runtime PM reference. Fixes:fdacc3c740("i2c: xiic: Switch from waitqueue to completion") Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Reviewed-by: Michal Simek <michal.simek@amd.com> Signed-off-by: Wolfram Sang <wsa@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
a712b5a952
commit
06e661a259
@ -704,7 +704,7 @@ static int xiic_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
|
|||||||
err = xiic_start_xfer(i2c, msgs, num);
|
err = xiic_start_xfer(i2c, msgs, num);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
dev_err(adap->dev.parent, "Error xiic_start_xfer\n");
|
dev_err(adap->dev.parent, "Error xiic_start_xfer\n");
|
||||||
return err;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = wait_for_completion_timeout(&i2c->completion, XIIC_XFER_TIMEOUT);
|
err = wait_for_completion_timeout(&i2c->completion, XIIC_XFER_TIMEOUT);
|
||||||
@ -722,6 +722,8 @@ static int xiic_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
|
|||||||
err = (i2c->state == STATE_DONE) ? num : -EIO;
|
err = (i2c->state == STATE_DONE) ? num : -EIO;
|
||||||
}
|
}
|
||||||
mutex_unlock(&i2c->lock);
|
mutex_unlock(&i2c->lock);
|
||||||
|
|
||||||
|
out:
|
||||||
pm_runtime_mark_last_busy(i2c->dev);
|
pm_runtime_mark_last_busy(i2c->dev);
|
||||||
pm_runtime_put_autosuspend(i2c->dev);
|
pm_runtime_put_autosuspend(i2c->dev);
|
||||||
return err;
|
return err;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user