]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
riscv: Fix missing __free_pages() in check_vector_unaligned_access()
authorAlexandre Ghiti <alexghiti@rivosinc.com>
Fri, 28 Feb 2025 09:06:13 +0000 (10:06 +0100)
committerAlexandre Ghiti <alexghiti@rivosinc.com>
Tue, 18 Mar 2025 13:37:56 +0000 (13:37 +0000)
The locally allocated pages are never freed up, so add the corresponding
__free_pages().

Fixes: e7c9d66e313b ("RISC-V: Report vector unaligned access speed hwprobe")
Link: https://lore.kernel.org/r/20250228090613.345309-1-alexghiti@rivosinc.com
Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
arch/riscv/kernel/unaligned_access_speed.c

index 91f189cf16113c9ab1f3a1c4789cf0b288325cb1..074ac4abd023ea7871b168f7b59b6951614bf0e7 100644 (file)
@@ -349,7 +349,7 @@ static void check_vector_unaligned_access(struct work_struct *work __always_unus
                pr_warn("cpu%d: rdtime lacks granularity needed to measure unaligned vector access speed\n",
                        cpu);
 
-               return;
+               goto free;
        }
 
        if (word_cycles < byte_cycles)
@@ -363,6 +363,9 @@ static void check_vector_unaligned_access(struct work_struct *work __always_unus
                (speed ==  RISCV_HWPROBE_MISALIGNED_VECTOR_FAST) ? "fast" : "slow");
 
        per_cpu(vector_misaligned_access, cpu) = speed;
+
+free:
+       __free_pages(page, MISALIGNED_BUFFER_ORDER);
 }
 
 static int riscv_online_cpu_vec(unsigned int cpu)