aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Gondois <[email protected]>2023-01-24 16:40:47 +0100
committerGreg Kroah-Hartman <[email protected]>2023-01-31 16:02:02 +0100
commitd931b83e62b1dd352fc326c0b1cf3be3ef19e113 (patch)
tree2ef0edb6f0fde2f697a4846ccb7df24ce0ed408a
parentecaef469920fd6d2c7687f19081946f47684a423 (diff)
cacheinfo: Make default acpi_get_cache_info() return an error
commit bd500361a937 ("ACPI: PPTT: Update acpi_find_last_cache_level() to acpi_get_cache_info()") updates the prototype of acpi_get_cache_info(). The cache 'levels' is update through a pointer and not the return value of the function. If CONFIG_ACPI_PPTT is not defined, acpi_get_cache_info() doesn't update its *levels and *split_levels parameters and returns 0. This can lead to a faulty behaviour. Make acpi_get_cache_info() return an error code if CONFIG_ACPI_PPTT is not defined. Also, In init_cache_level(), if no PPTT is present or CONFIG_ACPI_PPTT is not defined, instead of aborting if acpi_get_cache_info() returns an error code, just continue. This allows to try fetching the cache information from clidr_el1. Signed-off-by: Pierre Gondois <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
-rw-r--r--arch/arm64/kernel/cacheinfo.c2
-rw-r--r--include/linux/cacheinfo.h2
2 files changed, 2 insertions, 2 deletions
diff --git a/arch/arm64/kernel/cacheinfo.c b/arch/arm64/kernel/cacheinfo.c
index 36c3b07cdf2d..91677f4d3395 100644
--- a/arch/arm64/kernel/cacheinfo.c
+++ b/arch/arm64/kernel/cacheinfo.c
@@ -64,7 +64,7 @@ int init_cache_level(unsigned int cpu)
} else {
ret = acpi_get_cache_info(cpu, &fw_level, NULL);
if (ret < 0)
- return ret;
+ fw_level = 0;
}
if (fw_level < 0)
diff --git a/include/linux/cacheinfo.h b/include/linux/cacheinfo.h
index dfef57077cd0..908e19d17f49 100644
--- a/include/linux/cacheinfo.h
+++ b/include/linux/cacheinfo.h
@@ -100,7 +100,7 @@ static inline
int acpi_get_cache_info(unsigned int cpu,
unsigned int *levels, unsigned int *split_levels)
{
- return 0;
+ return -ENOENT;
}
#else
int acpi_get_cache_info(unsigned int cpu,