* [PATCH v2] coresight: Check runtime PM resume result
@ 2026-09-24 0:18 Yuho Choi
2026-09-24 8:15 ` Leo Yan
0 siblings, 1 reply; 2+ messages in thread
From: Yuho Choi @ 2026-09-24 0:18 UTC (permalink / raw)
To: Suzuki K Poulose
Cc: Mike Leach, James Clark, Leo Yan, Anshuman Khandual, coresight,
linux-arm-kernel, linux-kernel, Yuho Choi
coresight_get_ref() ignores the return value of pm_runtime_get_sync()
and reports success even when runtime resume fails. A path is then built
and the CoreSight device may be accessed while it remains powered off.
Use pm_runtime_resume_and_get() so a failed resume is reported and its
runtime PM usage reference is rolled back. Drop the module and device
references acquired before the resume attempt when it fails.
Fixes: 32b0707a4182 ("coresight: Add try_get_module() in coresight_grab_device()")
Signed-off-by: Yuho Choi <oss.patchbox@gmail.com>
---
Changes in v2:
- Point Fixes: at commit 32b0707a4182, which introduced coresight_get_ref()
with the unchecked pm_runtime_get_sync() (Anshuman Khandual)
- Switch to my oss.patchbox address
v1: https://lore.kernel.org/all/20260802232552.593435-1-dbgh9129@gmail.com/
drivers/hwtracing/coresight/coresight-core.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/hwtracing/coresight/coresight-core.c b/drivers/hwtracing/coresight/coresight-core.c
index 928488a216d4..c492f9082c46 100644
--- a/drivers/hwtracing/coresight/coresight-core.c
+++ b/drivers/hwtracing/coresight/coresight-core.c
@@ -843,7 +843,11 @@ static bool coresight_get_ref(struct coresight_device *csdev)
goto err_module;
/* Make sure the device is powered on */
- pm_runtime_get_sync(parent);
+ if (pm_runtime_resume_and_get(parent) < 0) {
+ module_put(drv->owner);
+ goto err_module;
+ }
+
return true;
err_module:
base-commit: f0100363d8c374bd8e9ea7c9ba02744f0b802ca4
--
2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v2] coresight: Check runtime PM resume result
2026-09-24 0:18 [PATCH v2] coresight: Check runtime PM resume result Yuho Choi
@ 2026-09-24 8:15 ` Leo Yan
0 siblings, 0 replies; 2+ messages in thread
From: Leo Yan @ 2026-09-24 8:15 UTC (permalink / raw)
To: Yuho Choi
Cc: Suzuki K Poulose, Mike Leach, James Clark, Anshuman Khandual,
coresight, linux-arm-kernel, linux-kernel
On Wed, Sep 23, 2026 at 08:18:56PM -0400, Yuho Choi wrote:
> @@ -843,7 +843,11 @@ static bool coresight_get_ref(struct coresight_device *csdev)
> goto err_module;
>
> /* Make sure the device is powered on */
> - pm_runtime_get_sync(parent);
> + if (pm_runtime_resume_and_get(parent) < 0) {
> + module_put(drv->owner);
> + goto err_module;
> + }
> +
There is already a patch that does something similar and fixes the same
errors across the CoreSight folder. See:
https://lore.kernel.org/linux-arm-kernel/20260911-b4-coresight-runtime-pm-failures-v1-1-acdf49756e11@qti.qualcomm.com/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-24 8:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-24 0:18 [PATCH v2] coresight: Check runtime PM resume result Yuho Choi
2026-09-24 8:15 ` Leo Yan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®