diff --git a/target/linux/sunxi/patches-6.6/024-v6.10-cpufreq-sun50i-Fix-build-warning-around-snprint.patch b/target/linux/sunxi/patches-6.6/024-v6.10-cpufreq-sun50i-Fix-build-warning-around-snprint.patch new file mode 100644 index 0000000000..8bfd6c2d09 --- /dev/null +++ b/target/linux/sunxi/patches-6.6/024-v6.10-cpufreq-sun50i-Fix-build-warning-around-snprint.patch @@ -0,0 +1,51 @@ +From d2059d3b548409905b20b4f52495bffbd7c8da8b Mon Sep 17 00:00:00 2001 +From: Viresh Kumar +Date: Mon, 22 Apr 2024 08:58:51 +0530 +Subject: [PATCH] cpufreq: sun50i: Fix build warning around snprint() + +The Sun50i driver generates a warning with W=1: + +warning: '%d' directive output may be truncated writing between 1 and 10 bytes into a region of size 2 [-Wformat-truncation=] + +Fix it by allocating a big enough array to print an integer. + +Reported-by: kernel test robot +Closes: https://lore.kernel.org/oe-kbuild-all/202404191715.LDwMm2gP-lkp@intel.com/ +Signed-off-by: Viresh Kumar +Acked-by: Chen-Yu Tsai +Reviewed-by: Andre Przywara +Tested-by: Andre Przywara +Reviewed-by: Julian Calaby +--- + drivers/cpufreq/sun50i-cpufreq-nvmem.c | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +--- a/drivers/cpufreq/sun50i-cpufreq-nvmem.c ++++ b/drivers/cpufreq/sun50i-cpufreq-nvmem.c +@@ -19,8 +19,6 @@ + #include + #include + +-#define MAX_NAME_LEN 7 +- + #define NVMEM_MASK 0x7 + #define NVMEM_SHIFT 5 + +@@ -208,7 +206,7 @@ static int sun50i_cpufreq_get_efuse(void + static int sun50i_cpufreq_nvmem_probe(struct platform_device *pdev) + { + int *opp_tokens; +- char name[MAX_NAME_LEN]; ++ char name[] = "speedXXXXXXXXXXX"; /* Integers can take 11 chars max */ + unsigned int cpu, supported_hw; + struct dev_pm_opp_config config = {}; + int speed; +@@ -235,7 +233,7 @@ static int sun50i_cpufreq_nvmem_probe(st + config.supported_hw_count = 1; + } + +- snprintf(name, MAX_NAME_LEN, "speed%d", speed); ++ snprintf(name, sizeof(name), "speed%d", speed); + config.prop_name = name; + + for_each_possible_cpu(cpu) { diff --git a/target/linux/sunxi/patches-6.6/025-v6.10-cpufreq-sun50i-fix-error-returns-in-dt_has_supported_hw.patch b/target/linux/sunxi/patches-6.6/025-v6.10-cpufreq-sun50i-fix-error-returns-in-dt_has_supported_hw.patch new file mode 100644 index 0000000000..2304a6af79 --- /dev/null +++ b/target/linux/sunxi/patches-6.6/025-v6.10-cpufreq-sun50i-fix-error-returns-in-dt_has_supported_hw.patch @@ -0,0 +1,34 @@ +From 76a6fc5644b2a1c70868bec24a078f784600ef2a Mon Sep 17 00:00:00 2001 +From: Dan Carpenter +Date: Wed, 24 Apr 2024 14:40:11 +0300 +Subject: [PATCH] cpufreq: sun50i: fix error returns in dt_has_supported_hw() + +The dt_has_supported_hw() function returns type bool. That means these +negative error codes are cast to true but the function should return +false instead. + +Fixes: fa5aec9561cf ("cpufreq: sun50i: Add support for opp_supported_hw") +Signed-off-by: Dan Carpenter +Reviewed-by: Andre Przywara +Reviewed-by: Jernej Skrabec +Signed-off-by: Viresh Kumar +--- + drivers/cpufreq/sun50i-cpufreq-nvmem.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/cpufreq/sun50i-cpufreq-nvmem.c ++++ b/drivers/cpufreq/sun50i-cpufreq-nvmem.c +@@ -136,11 +136,11 @@ static bool dt_has_supported_hw(void) + + cpu_dev = get_cpu_device(0); + if (!cpu_dev) +- return -ENODEV; ++ return false; + + np = dev_pm_opp_of_get_opp_desc_node(cpu_dev); + if (!np) +- return -ENOENT; ++ return false; + + for_each_child_of_node(np, opp) { + if (of_find_property(opp, "opp-supported-hw", NULL)) {