The branch main has been updated by olce:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=953b9164c3d93e820a53b4fdebbde7fabb7b7644

commit 953b9164c3d93e820a53b4fdebbde7fabb7b7644
Author:     Olivier Certner <[email protected]>
AuthorDate: 2026-02-12 12:33:46 +0000
Commit:     Olivier Certner <[email protected]>
CommitDate: 2026-02-20 10:12:53 +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
---
 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 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)

Reply via email to