[PATCH] arm64: cacheinfo: Simplify init_cache_level()

Thorsten Blum blum at kernel.org
Wed Nov 4 00:36:31 PST 2026


acpi_get_cache_info() already sets fw_level to 0 on failure, so drop the
redundant check and the manual assignment.

Use unsigned int for fw_level to match the expected type, and remove the
now-unused local ret variable.

Signed-off-by: Thorsten Blum <blum at kernel.org>
---
 arch/arm64/kernel/cacheinfo.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/arch/arm64/kernel/cacheinfo.c b/arch/arm64/kernel/cacheinfo.c
index 309942b06c5b..881131fb4934 100644
--- a/arch/arm64/kernel/cacheinfo.c
+++ b/arch/arm64/kernel/cacheinfo.c
@@ -67,19 +67,15 @@ int early_cache_level(unsigned int cpu)
 
 int init_cache_level(unsigned int cpu)
 {
-	unsigned int level, leaves;
-	int fw_level, ret;
+	unsigned int level, leaves, fw_level;
 	struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu);
 
 	detect_cache_level(&level, &leaves);
 
-	if (acpi_disabled) {
+	if (acpi_disabled)
 		fw_level = of_find_last_cache_level(cpu);
-	} else {
-		ret = acpi_get_cache_info(cpu, &fw_level, NULL);
-		if (ret < 0)
-			fw_level = 0;
-	}
+	else
+		acpi_get_cache_info(cpu, &fw_level, NULL);
 
 	if (level < fw_level) {
 		/*



More information about the linux-arm-kernel mailing list