git: b6bbc04fcd0b - stable/14 - cpufreq(4): cpufreq_levels_sysctl(): Remove always false NULL test
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 23 Jul 2026 10:00:34 UTC
The branch stable/14 has been updated by olce:
URL: https://cgit.FreeBSD.org/src/commit/?id=b6bbc04fcd0b7b9f6423d7914f554bcca4beec37
commit b6bbc04fcd0b7b9f6423d7914f554bcca4beec37
Author: Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2026-02-12 12:33:46 +0000
Commit: Olivier Certner <olce@FreeBSD.org>
CommitDate: 2026-07-23 09:59:02 +0000
cpufreq(4): cpufreq_levels_sysctl(): Remove always false NULL test
'sc->levels_buf' is initialized with malloc(M_WAITOK), so can never be
NULL. Another sysctl handler function (cpufreq_curr_sysctl()) already
relies on that.
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 953b9164c3d93e820a53b4fdebbde7fabb7b7644)
---
sys/kern/kern_cpu.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/sys/kern/kern_cpu.c b/sys/kern/kern_cpu.c
index 247b5f6c150a..24afc58cc88e 100644
--- a/sys/kern/kern_cpu.c
+++ b/sys/kern/kern_cpu.c
@@ -1003,16 +1003,12 @@ cpufreq_levels_sysctl(SYSCTL_HANDLER_ARGS)
struct sbuf sb;
int count, error, i;
- sc = oidp->oid_arg1;
sbuf_new(&sb, NULL, 128, SBUF_AUTOEXTEND);
/* Get settings from the device and generate the output string. */
- count = CF_MAX_LEVELS;
+ sc = oidp->oid_arg1;
levels = sc->levels_buf;
- if (levels == NULL) {
- sbuf_delete(&sb);
- return (ENOMEM);
- }
+ count = CF_MAX_LEVELS;
error = CPUFREQ_LEVELS(sc->dev, levels, &count);
if (error) {
if (error == E2BIG)