diff options
author | Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> | 2022-11-18 09:52:36 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-11-23 21:45:32 +0300 |
commit | 63c60a226c908f46589b57b5bcb220ca82a76cc5 (patch) | |
tree | d43bf76921106091965d577e2a03061bdc0517f7 /drivers/slimbus/qcom-ngd-ctrl.c | |
parent | 97e1a5309190aca528c7e12697a898bda793a460 (diff) | |
download | linux-63c60a226c908f46589b57b5bcb220ca82a76cc5.tar.xz |
slimbus: qcom-ngd-ctrl: drop PM runtime counter on transfer error paths
If transfer in qcom_slim_ngd_xfer_msg_sync() fails, we need to drop the
PM runtime usage counter to have it balanced.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20221118065246.6835-3-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/slimbus/qcom-ngd-ctrl.c')
-rw-r--r-- | drivers/slimbus/qcom-ngd-ctrl.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/slimbus/qcom-ngd-ctrl.c b/drivers/slimbus/qcom-ngd-ctrl.c index 964adf77b51b..d48e58ca5d58 100644 --- a/drivers/slimbus/qcom-ngd-ctrl.c +++ b/drivers/slimbus/qcom-ngd-ctrl.c @@ -919,21 +919,29 @@ static int qcom_slim_ngd_xfer_msg_sync(struct slim_controller *ctrl, DECLARE_COMPLETION_ONSTACK(done); int ret, timeout; - pm_runtime_get_sync(ctrl->dev); + ret = pm_runtime_get_sync(ctrl->dev); + if (ret < 0) + goto pm_put; txn->comp = &done; ret = qcom_slim_ngd_xfer_msg(ctrl, txn); if (ret) - return ret; + goto pm_put; timeout = wait_for_completion_timeout(&done, HZ); if (!timeout) { dev_err(ctrl->dev, "TX timed out:MC:0x%x,mt:0x%x", txn->mc, txn->mt); - return -ETIMEDOUT; + ret = -ETIMEDOUT; + goto pm_put; } return 0; + +pm_put: + pm_runtime_put(ctrl->dev); + + return ret; } static int qcom_slim_ngd_enable_stream(struct slim_stream_runtime *rt) |