Skip to content

Commit a263c1f

Browse files
Srinivas-Kandagatlagregkh
authored andcommitted
slimbus: messaging: check for valid transaction id
In some usecases transaction ids are dynamically allocated inside the controller driver after sending the messages which have generic acknowledge responses. So check for this before refcounting pm_runtime. Without this we would end up imbalancing runtime pm count by doing pm_runtime_put() in both slim_do_transfer() and slim_msg_response() for a single pm_runtime_get() in slim_do_transfer() Fixes: d3062a2 ("slimbus: messaging: add slim_alloc/free_txn_tid()") Cc: <[email protected]> Signed-off-by: Srinivas Kandagatla <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 9659281 commit a263c1f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/slimbus/messaging.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ int slim_do_transfer(struct slim_controller *ctrl, struct slim_msg_txn *txn)
131131
goto slim_xfer_err;
132132
}
133133
}
134-
134+
/* Initialize tid to invalid value */
135+
txn->tid = 0;
135136
need_tid = slim_tid_txn(txn->mt, txn->mc);
136137

137138
if (need_tid) {
@@ -163,7 +164,7 @@ int slim_do_transfer(struct slim_controller *ctrl, struct slim_msg_txn *txn)
163164
txn->mt, txn->mc, txn->la, ret);
164165

165166
slim_xfer_err:
166-
if (!clk_pause_msg && (!need_tid || ret == -ETIMEDOUT)) {
167+
if (!clk_pause_msg && (txn->tid == 0 || ret == -ETIMEDOUT)) {
167168
/*
168169
* remove runtime-pm vote if this was TX only, or
169170
* if there was error during this transaction

0 commit comments

Comments
 (0)