[PATCH] ACPI: GTDT: simplify acpi_gtdt_init() implementation
kernel test robot
lkp at intel.com
Mon Sep 30 11:22:59 PDT 2024
Hi Zheng,
kernel test robot noticed the following build warnings:
[auto build test WARNING on rafael-pm/linux-next]
[also build test WARNING on rafael-pm/bleeding-edge tip/timers/core linus/master v6.12-rc1 next-20240930]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Zheng-Zengkai/ACPI-GTDT-simplify-acpi_gtdt_init-implementation/20240930-105041
base: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
patch link: https://lore.kernel.org/r/20240930030716.179992-1-zhengzengkai%40huawei.com
patch subject: [PATCH] ACPI: GTDT: simplify acpi_gtdt_init() implementation
config: arm64-allmodconfig (https://download.01.org/0day-ci/archive/20241001/202410010101.2oPkEaoP-lkp@intel.com/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 7773243d9916f98ba0ffce0c3a960e4aa9f03e81)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241001/202410010101.2oPkEaoP-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp at intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202410010101.2oPkEaoP-lkp@intel.com/
All warnings (new ones prefixed by >>):
In file included from drivers/acpi/arm64/gtdt.c:11:
In file included from include/linux/acpi.h:39:
In file included from include/acpi/acpi_io.h:7:
In file included from arch/arm64/include/asm/acpi.h:14:
In file included from include/linux/memblock.h:12:
In file included from include/linux/mm.h:2236:
include/linux/vmstat.h:503:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
503 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
504 | item];
| ~~~~
include/linux/vmstat.h:510:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
510 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
511 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
include/linux/vmstat.h:517:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
517 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
include/linux/vmstat.h:523:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
523 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
524 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
>> drivers/acpi/arm64/gtdt.c:383:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
383 | if (!timer_count)
| ^~~~~~~~~~~~
drivers/acpi/arm64/gtdt.c:400:9: note: uninitialized use occurs here
400 | return ret;
| ^~~
drivers/acpi/arm64/gtdt.c:383:2: note: remove the 'if' if its condition is always false
383 | if (!timer_count)
| ^~~~~~~~~~~~~~~~~
384 | goto out_put_gtdt;
| ~~~~~~~~~~~~~~~~~
drivers/acpi/arm64/gtdt.c:365:9: note: initialize the variable 'ret' to silence this warning
365 | int ret, timer_count = 0, gwdt_count = 0;
| ^
| = 0
5 warnings generated.
vim +383 drivers/acpi/arm64/gtdt.c
360
361 static int __init gtdt_sbsa_gwdt_init(void)
362 {
363 void *platform_timer;
364 struct acpi_table_header *table;
365 int ret, timer_count = 0, gwdt_count = 0;
366
367 if (acpi_disabled)
368 return 0;
369
370 if (ACPI_FAILURE(acpi_get_table(ACPI_SIG_GTDT, 0, &table)))
371 return -EINVAL;
372
373 /*
374 * Note: Even though the global variable acpi_gtdt_desc has been
375 * initialized by acpi_gtdt_init() while initializing the arch timers,
376 * when we call this function to get SBSA watchdogs info from GTDT, the
377 * pointers stashed in it are stale (since they are early temporary
378 * mappings carried out before acpi_permanent_mmap is set) and we need
379 * to re-initialize them with permanent mapped pointer values to let the
380 * GTDT parsing possible.
381 */
382 acpi_gtdt_init(table, &timer_count);
> 383 if (!timer_count)
384 goto out_put_gtdt;
385
386 for_each_platform_timer(platform_timer) {
387 if (is_non_secure_watchdog(platform_timer)) {
388 ret = gtdt_import_sbsa_gwdt(platform_timer, gwdt_count);
389 if (ret)
390 break;
391 gwdt_count++;
392 }
393 }
394
395 if (gwdt_count)
396 pr_info("found %d SBSA generic Watchdog(s).\n", gwdt_count);
397
398 out_put_gtdt:
399 acpi_put_table(table);
400 return ret;
401 }
402
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
More information about the linux-arm-kernel
mailing list