• Arnd Bergmann's avatar
    rxrpc: avoid clang -Wuninitialized warning · 526949e8
    Arnd Bergmann authored
    clang produces a false-positive warning as it fails to notice
    that "lost = true" implies that "ret" is initialized:
    
    net/rxrpc/output.c:402:6: error: variable 'ret' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
            if (lost)
                ^~~~
    net/rxrpc/output.c:437:6: note: uninitialized use occurs here
            if (ret >= 0) {
                ^~~
    net/rxrpc/output.c:402:2: note: remove the 'if' if its condition is always false
            if (lost)
            ^~~~~~~~~
    net/rxrpc/output.c:339:9: note: initialize the variable 'ret' to silence this warning
            int ret, opt;
                   ^
                    = 0
    
    Rearrange the code to make that more obvious and avoid the warning.
    Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
    Reviewed-by: default avatarNathan Chancellor <natechancellor@gmail.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    526949e8
output.c 17.5 KB