mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-27 06:34:11 +08:00
4d2b8517ba
clang warns:
drivers/infiniband/sw/rdmavt/cq.c:260:7: warning: variable 'err' is used
uninitialized whenever 'if' condition is true
[-Wsometimes-uninitialized]
if (err)
^~~
drivers/infiniband/sw/rdmavt/cq.c:310:9: note: uninitialized use occurs
here
return err;
^~~
drivers/infiniband/sw/rdmavt/cq.c:260:3: note: remove the 'if' if its
condition is always false
if (err)
^~~~~~~~
drivers/infiniband/sw/rdmavt/cq.c:253:7: warning: variable 'err' is used
uninitialized whenever 'if' condition is true
[-Wsometimes-uninitialized]
if (!cq->ip) {
^~~~~~~
drivers/infiniband/sw/rdmavt/cq.c:310:9: note: uninitialized use occurs
here
return err;
^~~
drivers/infiniband/sw/rdmavt/cq.c:253:3: note: remove the 'if' if its
condition is always false
if (!cq->ip) {
^~~~~~~~~~~~~~
drivers/infiniband/sw/rdmavt/cq.c:211:9: note: initialize the variable
'err' to silence this warning
int err;
^
= 0
2 warnings generated.
The function scoped err variable is uninitialized when the flow jumps into
the if statement. The if scoped err variable shadows the function scoped
err variable, preventing the err assignments within the if statement to be
reflected at the function level, which will cause uninitialized use when
the goto statements are taken.
Just remove the if scoped err declaration so that there is only one copy
of the err variable for this function.
Fixes:
|
||
---|---|---|
.. | ||
ah.c | ||
ah.h | ||
cq.c | ||
cq.h | ||
Kconfig | ||
mad.c | ||
mad.h | ||
Makefile | ||
mcast.c | ||
mcast.h | ||
mmap.c | ||
mmap.h | ||
mr.c | ||
mr.h | ||
pd.c | ||
pd.h | ||
qp.c | ||
qp.h | ||
rc.c | ||
srq.c | ||
srq.h | ||
trace_cq.h | ||
trace_mr.h | ||
trace_qp.h | ||
trace_rc.h | ||
trace_rvt.h | ||
trace_tx.h | ||
trace.c | ||
trace.h | ||
vt.c | ||
vt.h |