drivers/power/reset/reboot-mode.c:39:2-7: WARNING: invalid free of devm_ allocated data

From: kernel test robot

Date: Sat Jul 18 2026 - 22:11:36 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 94515f3a7d4256a5062176b7d6ed0471938cd51a
commit: cfaf0a90789ac74391ac7583c86cdaaada78cdbb power: reset: reboot-mode: Expose sysfs for registered reboot_modes
date: 5 months ago
config: powerpc64-randconfig-r064-20260716 (https://download.01.org/0day-ci/archive/20260719/202607191025.h6bQp891-lkp@xxxxxxxxx/config)
compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project b3e6e6dabdc02153552a64fc74ff5c7532447eed)

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
| Fixes: cfaf0a90789a ("power: reset: reboot-mode: Expose sysfs for registered reboot_modes")
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202607191025.h6bQp891-lkp@xxxxxxxxx/

cocci warnings: (new ones prefixed by >>)
>> drivers/power/reset/reboot-mode.c:39:2-7: WARNING: invalid free of devm_ allocated data

vim +39 drivers/power/reset/reboot-mode.c

30
31 static inline void reboot_mode_release_list(struct reboot_mode_sysfs_data *priv)
32 {
33 struct mode_info *info;
34 struct mode_info *next;
35
36 list_for_each_entry_safe(info, next, &priv->head, list) {
37 list_del(&info->list);
38 kfree_const(info->mode);
> 39 kfree(info);
40 }
41 }
42

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki