Linux: -Wsometimes-uninitialized in drivers/infiniband/sw/rdmavt/cq.c

Created on 10 Jul 2019  路  3Comments  路  Source: ClangBuiltLinux/linux

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.

Ah C scoping bugs...

Patch sent: https://lore.kernel.org/lkml/[email protected]/

-Wsometimes-uninitialized [BUG] linux-next [FIXED][LINUX] -next

All 3 comments

v2 (commit message change only, code still the same): https://lore.kernel.org/lkml/[email protected]/

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tpimh picture tpimh  路  4Comments

nathanchance picture nathanchance  路  3Comments

nathanchance picture nathanchance  路  4Comments

nathanchance picture nathanchance  路  3Comments

nickdesaulniers picture nickdesaulniers  路  4Comments