* [PATCH] powercap: intel_rapl_tpmi: Handle PMU registration failure during probe
@ 2026-05-15 18:42 Sumeet Pawnikar
2026-05-26 13:34 ` Rafael J. Wysocki
0 siblings, 1 reply; 2+ messages in thread
From: Sumeet Pawnikar @ 2026-05-15 18:42 UTC (permalink / raw)
To: rafael, linux-pm; +Cc: linux-kernel, sumeet4linux
intel_rapl_tpmi_probe() invokes rapl_package_add_pmu() but it ignores
the return value, so a PMU registration failure may leave the driver
reporting probe success despite the PMU being absent, with no log
trace. Worse case scenario, the previously-added RAPL package would
not be torn down.
Add check for the return value, log the failure, undo the package
addition with rapl_remove_package() and fail the probe.
Signed-off-by: Sumeet Pawnikar <sumeet4linux@gmail.com>
---
drivers/powercap/intel_rapl_tpmi.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/powercap/intel_rapl_tpmi.c b/drivers/powercap/intel_rapl_tpmi.c
index 7f41491d9cd1..8bc95310b542 100644
--- a/drivers/powercap/intel_rapl_tpmi.c
+++ b/drivers/powercap/intel_rapl_tpmi.c
@@ -414,7 +414,14 @@ static int intel_rapl_tpmi_probe(struct auxiliary_device *auxdev,
goto err;
}
- rapl_package_add_pmu(trp->rp);
+ ret = rapl_package_add_pmu(trp->rp);
+ if (ret) {
+ dev_err(&auxdev->dev, "Failed to add RAPL PMU for Package%d, %d\n",
+ info->package_id, ret);
+ rapl_remove_package(trp->rp);
+ trp->rp = NULL;
+ goto err;
+ }
auxiliary_set_drvdata(auxdev, trp);
--
2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] powercap: intel_rapl_tpmi: Handle PMU registration failure during probe
2026-05-15 18:42 [PATCH] powercap: intel_rapl_tpmi: Handle PMU registration failure during probe Sumeet Pawnikar
@ 2026-05-26 13:34 ` Rafael J. Wysocki
0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2026-05-26 13:34 UTC (permalink / raw)
To: Sumeet Pawnikar; +Cc: rafael, linux-pm, linux-kernel
On Fri, May 15, 2026 at 8:43 PM Sumeet Pawnikar <sumeet4linux@gmail.com> wrote:
>
> intel_rapl_tpmi_probe() invokes rapl_package_add_pmu() but it ignores
> the return value, so a PMU registration failure may leave the driver
> reporting probe success despite the PMU being absent, with no log
> trace. Worse case scenario, the previously-added RAPL package would
> not be torn down.
>
> Add check for the return value, log the failure, undo the package
> addition with rapl_remove_package() and fail the probe.
>
> Signed-off-by: Sumeet Pawnikar <sumeet4linux@gmail.com>
> ---
> drivers/powercap/intel_rapl_tpmi.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/powercap/intel_rapl_tpmi.c b/drivers/powercap/intel_rapl_tpmi.c
> index 7f41491d9cd1..8bc95310b542 100644
> --- a/drivers/powercap/intel_rapl_tpmi.c
> +++ b/drivers/powercap/intel_rapl_tpmi.c
> @@ -414,7 +414,14 @@ static int intel_rapl_tpmi_probe(struct auxiliary_device *auxdev,
> goto err;
> }
>
> - rapl_package_add_pmu(trp->rp);
> + ret = rapl_package_add_pmu(trp->rp);
> + if (ret) {
> + dev_err(&auxdev->dev, "Failed to add RAPL PMU for Package%d, %d\n",
> + info->package_id, ret);
> + rapl_remove_package(trp->rp);
> + trp->rp = NULL;
> + goto err;
> + }
>
> auxiliary_set_drvdata(auxdev, trp);
>
Please see the sashiko.dev feedback on this:
https://sashiko.dev/#/patchset/20260515184250.228062-1-sumeet4linux%40gmail.com
and either address it or explain to me why it doesn't need to be addressed.
Thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-05-26 13:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-15 18:42 [PATCH] powercap: intel_rapl_tpmi: Handle PMU registration failure during probe Sumeet Pawnikar
2026-05-26 13:34 ` Rafael J. Wysocki
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®