[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202210061503.gBAGbL3p-lkp@intel.com>
Date: Thu, 6 Oct 2022 15:51:07 +0800
From: kernel test robot <lkp@...el.com>
To: "Paul E. McKenney" <paulmck@...nel.org>
Cc: llvm@...ts.linux.dev, kbuild-all@...ts.01.org,
Ammar Faizi <ammarfaizi2@...weeb.org>,
GNU/Weeb Mailing List <gwml@...r.gnuweeb.org>,
linux-kernel@...r.kernel.org
Subject: [ammarfaizi2-block:paulmck/linux-rcu/dev 41/41] kernel/cpu.c:206:56:
warning: variable 'cb' is uninitialized when used here
tree: https://github.com/ammarfaizi2/linux-block paulmck/linux-rcu/dev
head: 0b2715652d6ac3f3f496384d3c8dc3ccc46a6c18
commit: 0b2715652d6ac3f3f496384d3c8dc3ccc46a6c18 [41/41] EXP cpu: Add CPU-online debugging
config: i386-randconfig-a003-20221003
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/ammarfaizi2/linux-block/commit/0b2715652d6ac3f3f496384d3c8dc3ccc46a6c18
git remote add ammarfaizi2-block https://github.com/ammarfaizi2/linux-block
git fetch --no-tags ammarfaizi2-block paulmck/linux-rcu/dev
git checkout 0b2715652d6ac3f3f496384d3c8dc3ccc46a6c18
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>
All warnings (new ones prefixed by >>):
>> kernel/cpu.c:206:56: warning: variable 'cb' is uninitialized when used here [-Wuninitialized]
pr_warn("%s(%d): %ps returned %d\n", __func__, cpu, cb, ret);
^~
include/linux/printk.h:517:37: note: expanded from macro 'pr_warn'
printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
^~~~~~~~~~~
include/linux/printk.h:464:60: note: expanded from macro 'printk'
#define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
^~~~~~~~~~~
include/linux/printk.h:436:19: note: expanded from macro 'printk_index_wrap'
_p_func(_fmt, ##__VA_ARGS__); \
^~~~~~~~~~~
kernel/cpu.c:174:29: note: initialize the variable 'cb' to silence this warning
int (*cb)(unsigned int cpu);
^
= NULL
1 warning generated.
vim +/cb +206 kernel/cpu.c
154
155 /**
156 * cpuhp_invoke_callback - Invoke the callbacks for a given state
157 * @cpu: The cpu for which the callback should be invoked
158 * @state: The state to do callbacks for
159 * @bringup: True if the bringup callback should be invoked
160 * @node: For multi-instance, do a single entry callback for install/remove
161 * @lastp: For multi-instance rollback, remember how far we got
162 *
163 * Called from cpu hotplug and from the state register machinery.
164 *
165 * Return: %0 on success or a negative errno code
166 */
167 static int cpuhp_invoke_callback(unsigned int cpu, enum cpuhp_state state,
168 bool bringup, struct hlist_node *node,
169 struct hlist_node **lastp)
170 {
171 struct cpuhp_cpu_state *st = per_cpu_ptr(&cpuhp_state, cpu);
172 struct cpuhp_step *step = cpuhp_get_step(state);
173 int (*cbm)(unsigned int cpu, struct hlist_node *node);
174 int (*cb)(unsigned int cpu);
175 int ret, cnt;
176
177 if (st->fail == state) {
178 st->fail = CPUHP_INVALID;
179 return -EAGAIN;
180 }
181
182 if (cpuhp_step_empty(bringup, step)) {
183 WARN_ON_ONCE(1);
184 return 0;
185 }
186
187 if (!step->multi_instance) {
188 WARN_ON_ONCE(lastp && *lastp);
189 cb = bringup ? step->startup.single : step->teardown.single;
190
191 trace_cpuhp_enter(cpu, st->target, state, cb);
192 ret = cb(cpu);
193 if (!ret && bringup)
194 pr_warn("%s(%d): %ps returned %d\n", __func__, cpu, cb, ret);
195 trace_cpuhp_exit(cpu, st->state, state, ret);
196 return ret;
197 }
198 cbm = bringup ? step->startup.multi : step->teardown.multi;
199
200 /* Single invocation for instance add/remove */
201 if (node) {
202 WARN_ON_ONCE(lastp && *lastp);
203 trace_cpuhp_multi_enter(cpu, st->target, state, cbm, node);
204 ret = cbm(cpu, node);
205 if (!ret && bringup)
> 206 pr_warn("%s(%d): %ps returned %d\n", __func__, cpu, cb, ret);
207 trace_cpuhp_exit(cpu, st->state, state, ret);
208 return ret;
209 }
210
211 /* State transition. Invoke on all instances */
212 cnt = 0;
213 hlist_for_each(node, &step->list) {
214 if (lastp && node == *lastp)
215 break;
216
217 trace_cpuhp_multi_enter(cpu, st->target, state, cbm, node);
218 ret = cbm(cpu, node);
219 if (!ret && bringup)
220 pr_warn("%s(%d): %ps returned %d\n", __func__, cpu, cb, ret);
221 trace_cpuhp_exit(cpu, st->state, state, ret);
222 if (ret) {
223 if (!lastp)
224 goto err;
225
226 *lastp = node;
227 return ret;
228 }
229 cnt++;
230 }
231 if (lastp)
232 *lastp = NULL;
233 return 0;
234 err:
235 /* Rollback the instances if one failed */
236 cbm = !bringup ? step->startup.multi : step->teardown.multi;
237 if (!cbm)
238 return ret;
239
240 hlist_for_each(node, &step->list) {
241 if (!cnt--)
242 break;
243
244 trace_cpuhp_multi_enter(cpu, st->target, state, cbm, node);
245 ret = cbm(cpu, node);
246 if (!ret && bringup)
247 pr_warn("%s(%d): %ps returned %d\n", __func__, cpu, cb, ret);
248 trace_cpuhp_exit(cpu, st->state, state, ret);
249 /*
250 * Rollback must not fail,
251 */
252 WARN_ON_ONCE(ret);
253 }
254 return ret;
255 }
256
--
0-DAY CI Kernel Test Service
https://01.org/lkp
View attachment "config" of type "text/plain" (146197 bytes)
Powered by blists - more mailing lists