Skip to content

Commit d663d93

Browse files
larsclausenwsakernel
authored andcommitted
i2c: xiic: xiic_xfer(): Fix runtime PM leak on error path
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: fdacc3c ("i2c: xiic: Switch from waitqueue to completion") Signed-off-by: Lars-Peter Clausen <[email protected]> Reviewed-by: Michal Simek <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
1 parent ae1664f commit d663d93

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/i2c/busses/i2c-xiic.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1164,7 +1164,7 @@ static int xiic_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
11641164
err = xiic_start_xfer(i2c, msgs, num);
11651165
if (err < 0) {
11661166
dev_err(adap->dev.parent, "Error xiic_start_xfer\n");
1167-
return err;
1167+
goto out;
11681168
}
11691169

11701170
err = wait_for_completion_timeout(&i2c->completion, XIIC_XFER_TIMEOUT);
@@ -1178,6 +1178,8 @@ static int xiic_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
11781178
err = (i2c->state == STATE_DONE) ? num : -EIO;
11791179
}
11801180
mutex_unlock(&i2c->lock);
1181+
1182+
out:
11811183
pm_runtime_mark_last_busy(i2c->dev);
11821184
pm_runtime_put_autosuspend(i2c->dev);
11831185
return err;

0 commit comments

Comments
 (0)