diff options
| author | Olivier Certner <olce@FreeBSD.org> | 2026-02-12 12:33:46 +0000 |
|---|---|---|
| committer | Olivier Certner <olce@FreeBSD.org> | 2026-02-20 10:12:53 +0000 |
| commit | 953b9164c3d93e820a53b4fdebbde7fabb7b7644 (patch) | |
| tree | 51e927942d7d0f15d50fb20256836edecc8de283 | |
| parent | 80d32a6b1d73e0c81303417fa280ac74ef1f417a (diff) | |
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
| -rw-r--r-- | sys/kern/kern_cpu.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/sys/kern/kern_cpu.c b/sys/kern/kern_cpu.c index 1fb3d8002c7f..03d2d38e1749 100644 --- a/sys/kern/kern_cpu.c +++ b/sys/kern/kern_cpu.c @@ -1002,16 +1002,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) |
