From: Johan Hovold <johan@kernel.org>
To: Srinivas Kandagatla <srini@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
Johan Hovold <johan@kernel.org>,
stable@vger.kernel.org
Subject: [PATCH 2/6] slimbus: core: fix runtime PM imbalance on report present
Date: Wed, 26 Nov 2025 15:53:25 +0100 [thread overview]
Message-ID: <20251126145329.5022-3-johan@kernel.org> (raw)
In-Reply-To: <20251126145329.5022-1-johan@kernel.org>
Make sure to balance the runtime PM usage count in case slimbus device
or address allocation fails on report present, which would otherwise
prevent the controller from suspending.
Fixes: 4b14e62ad3c9 ("slimbus: Add support for 'clock-pause' feature")
Cc: stable@vger.kernel.org # 4.16
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/slimbus/core.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/drivers/slimbus/core.c b/drivers/slimbus/core.c
index c808233692ee..9f85c4280171 100644
--- a/drivers/slimbus/core.c
+++ b/drivers/slimbus/core.c
@@ -489,21 +489,23 @@ int slim_device_report_present(struct slim_controller *ctrl,
if (ctrl->sched.clk_state != SLIM_CLK_ACTIVE) {
dev_err(ctrl->dev, "slim ctrl not active,state:%d, ret:%d\n",
ctrl->sched.clk_state, ret);
- goto slimbus_not_active;
+ goto out_put_rpm;
}
sbdev = slim_get_device(ctrl, e_addr);
- if (IS_ERR(sbdev))
- return -ENODEV;
+ if (IS_ERR(sbdev)) {
+ ret = -ENODEV;
+ goto out_put_rpm;
+ }
if (sbdev->is_laddr_valid) {
*laddr = sbdev->laddr;
- return 0;
+ ret = 0;
+ } else {
+ ret = slim_device_alloc_laddr(sbdev, true);
}
- ret = slim_device_alloc_laddr(sbdev, true);
-
-slimbus_not_active:
+out_put_rpm:
pm_runtime_mark_last_busy(ctrl->dev);
pm_runtime_put_autosuspend(ctrl->dev);
return ret;
--
2.51.2
next prev parent reply other threads:[~2025-11-26 14:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-26 14:53 [PATCH 0/6] slimbus: core: fix device, OF node and rpm leaks Johan Hovold
2025-11-26 14:53 ` [PATCH 1/6] slimbus: core: fix OF node leak on registration failure Johan Hovold
2025-11-26 14:53 ` Johan Hovold [this message]
2025-11-26 14:53 ` [PATCH 3/6] slimbus: core: fix device reference leak on report present Johan Hovold
2025-11-26 14:53 ` [PATCH 4/6] slimbus: core: amend slim_get_device() kernel doc Johan Hovold
2025-11-26 14:53 ` [PATCH 5/6] slimbus: core: fix of_slim_get_device() " Johan Hovold
2025-11-26 14:53 ` [PATCH 6/6] slimbus: core: clean up of_slim_get_device() Johan Hovold
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251126145329.5022-3-johan@kernel.org \
--to=johan@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=srini@kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox