Linux s390 Architecture development
 help / color / mirror / Atom feed
From: Thomas Richter <tmricht@linux.ibm.com>
To: linux-s390@vger.kernel.org, japo@linux.ibm.com, sumanthk@linux.ibm.com
Cc: Thomas Richter <tmricht@linux.ibm.com>
Subject: [PATCH] s390/pai: Simplify pai_init() and always return -ENODEV on failure
Date: Thu,  3 Sep 2026 10:15:57 +0200	[thread overview]
Message-ID: <20260903081557.2023814-1-tmricht@linux.ibm.com> (raw)

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


                 reply	other threads:[~2026-09-03  8:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20260903081557.2023814-1-tmricht@linux.ibm.com \
    --to=tmricht@linux.ibm.com \
    --cc=japo@linux.ibm.com \
    --cc=linux-s390@vger.kernel.org \
    --cc=sumanthk@linux.ibm.com \
    /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