From: "Mario Limonciello (AMD)" <superm1@kernel.org>
To: "Gautham R . Shenoy" <gautham.shenoy@amd.com>
Cc: Perry Yuan <perry.yuan@amd.com>,
linux-kernel@vger.kernel.org (open list:X86 ARCHITECTURE (32-BIT
AND 64-BIT)),
linux-pm@vger.kernel.org (open list:CPU FREQUENCY SCALING
FRAMEWORK), "Mario Limonciello (AMD)" <superm1@kernel.org>
Subject: [PATCH v2 2/6] cpufreq/amd-pstate: Drop NULL value from amd_pstate_mode_string
Date: Thu, 9 Oct 2025 11:17:52 -0500 [thread overview]
Message-ID: <20251009161756.2728199-3-superm1@kernel.org> (raw)
In-Reply-To: <20251009161756.2728199-1-superm1@kernel.org>
None of the users actually look for the NULL value. To avoid risk
of regression introducing a new value but forgetting to add a string
add a static assert to test AMD_PSTATE_MAX matches the array size.
Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
---
drivers/cpufreq/amd-pstate.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
index 0bc5013448873..a5b9e5baf4234 100644
--- a/drivers/cpufreq/amd-pstate.c
+++ b/drivers/cpufreq/amd-pstate.c
@@ -65,8 +65,8 @@ static const char * const amd_pstate_mode_string[] = {
[AMD_PSTATE_PASSIVE] = "passive",
[AMD_PSTATE_ACTIVE] = "active",
[AMD_PSTATE_GUIDED] = "guided",
- NULL,
};
+static_assert(ARRAY_SIZE(amd_pstate_mode_string) == AMD_PSTATE_MAX);
const char *amd_pstate_get_mode_string(enum amd_pstate_mode mode)
{
--
2.43.0
next prev parent reply other threads:[~2025-10-09 16:18 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-09 16:17 [PATCH v2 0/6] amd-pstate optimizations Mario Limonciello (AMD)
2025-10-09 16:17 ` [PATCH v2 1/6] cpufreq/amd-pstate: Use sysfs_match_string() for epp Mario Limonciello (AMD)
2025-10-15 8:46 ` Gautham R. Shenoy
2025-10-09 16:17 ` Mario Limonciello (AMD) [this message]
2025-10-15 8:47 ` [PATCH v2 2/6] cpufreq/amd-pstate: Drop NULL value from amd_pstate_mode_string Gautham R. Shenoy
2025-10-09 16:17 ` [PATCH v2 3/6] cpufreq/amd-pstate: Make amd_pstate_get_mode_string() never return NULL Mario Limonciello (AMD)
2025-10-15 8:51 ` Gautham R. Shenoy
2025-10-09 16:17 ` [PATCH v2 4/6] cpufreq/amd-pstate: Adjust return values in amd_pstate_update_status() Mario Limonciello (AMD)
2025-10-15 9:02 ` Gautham R. Shenoy
2025-10-09 16:17 ` [PATCH v2 5/6] cpufreq/amd-pstate: Fix some whitespace issues Mario Limonciello (AMD)
2025-10-15 9:04 ` Gautham R. Shenoy
2025-10-09 16:17 ` [PATCH v2 6/6] cpufreq/amd-pstate: Add static asserts for EPP indices Mario Limonciello (AMD)
2025-10-15 9:11 ` Gautham R. Shenoy
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=20251009161756.2728199-3-superm1@kernel.org \
--to=superm1@kernel.org \
--cc=gautham.shenoy@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=perry.yuan@amd.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;
as well as URLs for NNTP newsgroup(s).