[PATCH v10 01/10] power: reset: reboot-mode: Add device tree node-based registration
kernel test robot
lkp at intel.com
Thu Jul 10 18:14:05 PDT 2025
Hi Shivendra,
kernel test robot noticed the following build errors:
[auto build test ERROR on 58ba80c4740212c29a1cf9b48f588e60a7612209]
url: https://github.com/intel-lab-lkp/linux/commits/Shivendra-Pratap/power-reset-reboot-mode-Add-device-tree-node-based-registration/20250710-172104
base: 58ba80c4740212c29a1cf9b48f588e60a7612209
patch link: https://lore.kernel.org/r/20250710-arm-psci-system_reset2-vendor-reboots-v10-1-b2d3b882be85%40oss.qualcomm.com
patch subject: [PATCH v10 01/10] power: reset: reboot-mode: Add device tree node-based registration
config: i386-buildonly-randconfig-006-20250711 (https://download.01.org/0day-ci/archive/20250711/202507110849.ahNmViin-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250711/202507110849.ahNmViin-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/202507110849.ahNmViin-lkp@intel.com/
All error/warnings (new ones prefixed by >>):
>> drivers/power/reset/reboot-mode.c:15:9: warning: 'pr_fmt' macro redefined [-Wmacro-redefined]
15 | #define pr_fmt(fmt) "reboot-mode: " fmt
| ^
include/linux/printk.h:397:9: note: previous definition is here
397 | #define pr_fmt(fmt) fmt
| ^
>> drivers/power/reset/reboot-mode.c:86:10: error: call to undeclared function 'kzalloc'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
86 | info = kzalloc(sizeof(*info), GFP_KERNEL);
| ^
>> drivers/power/reset/reboot-mode.c:86:8: error: incompatible integer to pointer conversion assigning to 'struct mode_info *' from 'int' [-Wint-conversion]
86 | info = kzalloc(sizeof(*info), GFP_KERNEL);
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/power/reset/reboot-mode.c:94:4: error: call to undeclared function 'kfree'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
94 | kfree(info);
| ^
drivers/power/reset/reboot-mode.c:139:3: error: call to undeclared function 'kfree'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
139 | kfree(info);
| ^
1 warning and 4 errors generated.
vim +/kzalloc +86 drivers/power/reset/reboot-mode.c
13
14 #define PREFIX "mode-"
> 15 #define pr_fmt(fmt) "reboot-mode: " fmt
16
17 struct mode_info {
18 const char *mode;
19 u32 magic;
20 struct list_head list;
21 };
22
23 static unsigned int get_reboot_mode_magic(struct reboot_mode_driver *reboot,
24 const char *cmd)
25 {
26 const char *normal = "normal";
27 struct mode_info *info;
28 char cmd_[110];
29
30 if (!cmd)
31 cmd = normal;
32
33 list_for_each_entry(info, &reboot->head, list)
34 if (!strcmp(info->mode, cmd))
35 return info->magic;
36
37 /* try to match again, replacing characters impossible in DT */
38 if (strscpy(cmd_, cmd, sizeof(cmd_)) == -E2BIG)
39 return 0;
40
41 strreplace(cmd_, ' ', '-');
42 strreplace(cmd_, ',', '-');
43 strreplace(cmd_, '/', '-');
44
45 list_for_each_entry(info, &reboot->head, list)
46 if (!strcmp(info->mode, cmd_))
47 return info->magic;
48
49 return 0;
50 }
51
52 static int reboot_mode_notify(struct notifier_block *this,
53 unsigned long mode, void *cmd)
54 {
55 struct reboot_mode_driver *reboot;
56 unsigned int magic;
57
58 reboot = container_of(this, struct reboot_mode_driver, reboot_notifier);
59 magic = get_reboot_mode_magic(reboot, cmd);
60 if (magic)
61 reboot->write(reboot, magic);
62
63 return NOTIFY_DONE;
64 }
65
66 /**
67 * reboot_mode_register - register a reboot mode driver
68 * @reboot: reboot mode driver
69 * @np: Pointer to device tree node
70 *
71 * Returns: 0 on success or a negative error code on failure.
72 */
73 int reboot_mode_register(struct reboot_mode_driver *reboot, struct device_node *np)
74 {
75 struct mode_info *info;
76 struct property *prop;
77 size_t len = strlen(PREFIX);
78 int ret;
79
80 INIT_LIST_HEAD(&reboot->head);
81
82 for_each_property_of_node(np, prop) {
83 if (strncmp(prop->name, PREFIX, len))
84 continue;
85
> 86 info = kzalloc(sizeof(*info), GFP_KERNEL);
87 if (!info) {
88 ret = -ENOMEM;
89 goto error;
90 }
91
92 if (of_property_read_u32(np, prop->name, &info->magic)) {
93 pr_err("reboot mode %s without magic number\n", info->mode);
> 94 kfree(info);
95 continue;
96 }
97
98 info->mode = kstrdup_const(prop->name + len, GFP_KERNEL);
99 if (!info->mode) {
100 ret = -ENOMEM;
101 goto error;
102 } else if (info->mode[0] == '\0') {
103 kfree_const(info->mode);
104 ret = -EINVAL;
105 pr_err("invalid mode name(%s): too short!\n", prop->name);
106 goto error;
107 }
108
109 list_add_tail(&info->list, &reboot->head);
110 }
111
112 reboot->reboot_notifier.notifier_call = reboot_mode_notify;
113 register_reboot_notifier(&reboot->reboot_notifier);
114
115 return 0;
116
117 error:
118 list_for_each_entry(info, &reboot->head, list)
119 kfree_const(info->mode);
120
121 return ret;
122 }
123 EXPORT_SYMBOL_GPL(reboot_mode_register);
124
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
More information about the linux-arm-kernel
mailing list