Linux s390 Architecture development
 help / color / mirror / Atom feed
* [PATCH] s390/pai: Simplify pai_init() and always return -ENODEV on failure
@ 2026-09-03  8:15 Thomas Richter
  0 siblings, 0 replies; only message in thread
From: Thomas Richter @ 2026-09-03  8:15 UTC (permalink / raw)
  To: linux-s390, japo, sumanthk; +Cc: Thomas Richter

Code simplification and remove variable state.
Return -ENODEV in all failures to indicate the PAI PMUs are not
available.

Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
---
 arch/s390/kernel/perf_pai.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/arch/s390/kernel/perf_pai.c b/arch/s390/kernel/perf_pai.c
index 013c3dae21ec..b6c9dca09510 100644
--- a/arch/s390/kernel/perf_pai.c
+++ b/arch/s390/kernel/perf_pai.c
@@ -1304,7 +1304,7 @@ static int pai_offline_cpu(unsigned int cpu)
 
 static int __init pai_init(void)
 {
-	int state, rc;
+	int rc;
 
 	/* Setup s390dbf facility */
 	paidbg = debug_register("pai", 1, 1, 128);
@@ -1315,23 +1315,21 @@ static int __init pai_init(void)
 	debug_register_view(paidbg, &debug_sprintf_view);
 
 	/* CPUHP_BP_PREPARE_DYN --> before CPU is brought online */
-	state = cpuhp_setup_state(CPUHP_BP_PREPARE_DYN, "perf/pai:prepare",
-				  pai_online_cpu, pai_offline_cpu);
-	rc = state < 0 ? state : 0;
+	rc = cpuhp_setup_state(CPUHP_BP_PREPARE_DYN, "perf/pai:prepare",
+			       pai_online_cpu, pai_offline_cpu);
 	if (rc < 0)
 		goto out_debug;
 
-	rc = -ENODEV;
 	if (!paipmu_setup())
 		goto out_cpuhp;
 	return 0;
 
 out_cpuhp:
-	cpuhp_remove_state(state);
+	cpuhp_remove_state(rc);
 out_debug:
 	debug_unregister_view(paidbg, &debug_sprintf_view);
 	debug_unregister(paidbg);
-	return rc;
+	return -ENODEV;
 }
 
 device_initcall(pai_init);
-- 
2.55.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-09-03  8:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-03  8:15 [PATCH] s390/pai: Simplify pai_init() and always return -ENODEV on failure Thomas Richter

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