Skip to content
Snippets Groups Projects
Commit a263c1ff authored by Srinivas Kandagatla's avatar Srinivas Kandagatla Committed by Greg Kroah-Hartman
Browse files

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: d3062a21 ("slimbus: messaging: add slim_alloc/free_txn_tid()")
Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20210809082428.11236-3-srinivas.kandagatla@linaro.org


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9659281c
No related branches found
No related tags found
No related merge requests found
...@@ -131,7 +131,8 @@ int slim_do_transfer(struct slim_controller *ctrl, struct slim_msg_txn *txn) ...@@ -131,7 +131,8 @@ int slim_do_transfer(struct slim_controller *ctrl, struct slim_msg_txn *txn)
goto slim_xfer_err; goto slim_xfer_err;
} }
} }
/* Initialize tid to invalid value */
txn->tid = 0;
need_tid = slim_tid_txn(txn->mt, txn->mc); need_tid = slim_tid_txn(txn->mt, txn->mc);
if (need_tid) { if (need_tid) {
...@@ -163,7 +164,7 @@ int slim_do_transfer(struct slim_controller *ctrl, struct slim_msg_txn *txn) ...@@ -163,7 +164,7 @@ int slim_do_transfer(struct slim_controller *ctrl, struct slim_msg_txn *txn)
txn->mt, txn->mc, txn->la, ret); txn->mt, txn->mc, txn->la, ret);
slim_xfer_err: slim_xfer_err:
if (!clk_pause_msg && (!need_tid || ret == -ETIMEDOUT)) { if (!clk_pause_msg && (txn->tid == 0 || ret == -ETIMEDOUT)) {
/* /*
* remove runtime-pm vote if this was TX only, or * remove runtime-pm vote if this was TX only, or
* if there was error during this transaction * if there was error during this transaction
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment