[ammarfaizi2-block:dhowells/linux-fs/rxrpc-multiqueue 3/5] fs/afs/rxrpc.c:155:6: warning: variable 'o' is used uninitialized whenever 'if' condition is false

From: kernel test robot
Date: Tue Jun 21 2022 - 15:34:17 EST


tree: https://github.com/ammarfaizi2/linux-block dhowells/linux-fs/rxrpc-multiqueue
head: f37988fef6da3fdc3545e5a65eb9241f82f539f2
commit: 928631b5285b0aaebed61025256868cd126c9281 [3/5] rxrpc: Allow UDP socket sharing for AF_RXRPC service sockets
config: i386-randconfig-a015 (https://download.01.org/0day-ci/archive/20220622/202206220318.jPFg84u7-lkp@xxxxxxxxx/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project af6d2a0b6825e71965f3e2701a63c239fa0ad70f)
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/928631b5285b0aaebed61025256868cd126c9281
git remote add ammarfaizi2-block https://github.com/ammarfaizi2/linux-block
git fetch --no-tags ammarfaizi2-block dhowells/linux-fs/rxrpc-multiqueue
git checkout 928631b5285b0aaebed61025256868cd126c9281
# 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 fs/afs/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

>> fs/afs/rxrpc.c:155:6: warning: variable 'o' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (!prealloc)
^~~~~~~~~
fs/afs/rxrpc.c:157:48: note: uninitialized use occurs here
trace_afs_call(call, afs_call_trace_alloc, 1, o,
^
fs/afs/rxrpc.c:155:2: note: remove the 'if' if its condition is always true
if (!prealloc)
^~~~~~~~~~~~~~
fs/afs/rxrpc.c:140:7: note: initialize the variable 'o' to silence this warning
int o;
^
= 0
1 warning generated.


vim +155 fs/afs/rxrpc.c

131
132 /*
133 * Allocate a call.
134 */
135 static struct afs_call *afs_alloc_call(struct afs_net *net,
136 const struct afs_call_type *type,
137 bool prealloc, gfp_t gfp)
138 {
139 struct afs_call *call;
140 int o;
141
142 call = kzalloc(sizeof(*call), gfp);
143 if (!call)
144 return NULL;
145
146 call->type = type;
147 call->net = net;
148 call->debug_id = atomic_inc_return(&rxrpc_debug_id);
149 atomic_set(&call->usage, 1);
150 INIT_WORK(&call->async_work, afs_process_async_call);
151 init_waitqueue_head(&call->waitq);
152 spin_lock_init(&call->state_lock);
153 call->iter = &call->def_iter;
154
> 155 if (!prealloc)
156 o = atomic_inc_return(&net->nr_outstanding_calls);
157 trace_afs_call(call, afs_call_trace_alloc, 1, o,
158 __builtin_return_address(0));
159 return call;
160 }
161

--
0-DAY CI Kernel Test Service
https://01.org/lkp