The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH v1] coresight: Check runtime PM resume result
@ 2026-08-02 23:25 Yuho Choi
  2026-08-03  5:02 ` Anshuman Khandual
  0 siblings, 1 reply; 2+ messages in thread
From: Yuho Choi @ 2026-08-02 23:25 UTC (permalink / raw)
  To: suzuki.poulose
  Cc: mike.leach, james.clark, leo.yan, alexander.shishkin, 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: 5da5325fa856 ("coresight: moving PM runtime operations to core framework")
Signed-off-by: Yuho Choi <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 6d65c43d574f..77d05b360484 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:
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v1] coresight: Check runtime PM resume result
  2026-08-02 23:25 [PATCH v1] coresight: Check runtime PM resume result Yuho Choi
@ 2026-08-03  5:02 ` Anshuman Khandual
  0 siblings, 0 replies; 2+ messages in thread
From: Anshuman Khandual @ 2026-08-03  5:02 UTC (permalink / raw)
  To: Yuho Choi, suzuki.poulose
  Cc: mike.leach, james.clark, leo.yan, alexander.shishkin, coresight,
	linux-arm-kernel, linux-kernel



On 03/08/26 4:55 AM, Yuho Choi wrote:
> 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: 5da5325fa856 ("coresight: moving PM runtime operations to core framework")
> Signed-off-by: Yuho Choi <dbgh9129@gmail.com>
> ---

Should 'Fixes:' be tagging the following commit - which had introduced
coresight_get_ref() unconditionally calling pm_runtime_get_sync() ?

32b0707a4182 ("coresight: Add try_get_module() in coresight_grab_device()")

>  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 6d65c43d574f..77d05b360484 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:


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-08-03  5:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-02 23:25 [PATCH v1] coresight: Check runtime PM resume result Yuho Choi
2026-08-03  5:02 ` Anshuman Khandual

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox