diff options
author | Arnd Bergmann <arnd@arndb.de> | 2019-03-22 10:18:43 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-03-23 21:48:30 -0400 |
commit | 526949e877f44672d408bfe291e39860c13f2e24 (patch) | |
tree | 31458a80362a0cfc6ea601f65746db740d16044f /net/rxrpc | |
parent | 737889efe9713a0f20a75fd0de952841d9275e6b (diff) |
rxrpc: avoid clang -Wuninitialized warning
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: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/rxrpc')
-rw-r--r-- | net/rxrpc/output.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/net/rxrpc/output.c b/net/rxrpc/output.c index 736aa9281100..004c762c2e8d 100644 --- a/net/rxrpc/output.c +++ b/net/rxrpc/output.c | |||
@@ -335,7 +335,6 @@ int rxrpc_send_data_packet(struct rxrpc_call *call, struct sk_buff *skb, | |||
335 | struct kvec iov[2]; | 335 | struct kvec iov[2]; |
336 | rxrpc_serial_t serial; | 336 | rxrpc_serial_t serial; |
337 | size_t len; | 337 | size_t len; |
338 | bool lost = false; | ||
339 | int ret, opt; | 338 | int ret, opt; |
340 | 339 | ||
341 | _enter(",{%d}", skb->len); | 340 | _enter(",{%d}", skb->len); |
@@ -393,14 +392,14 @@ int rxrpc_send_data_packet(struct rxrpc_call *call, struct sk_buff *skb, | |||
393 | static int lose; | 392 | static int lose; |
394 | if ((lose++ & 7) == 7) { | 393 | if ((lose++ & 7) == 7) { |
395 | ret = 0; | 394 | ret = 0; |
396 | lost = true; | 395 | trace_rxrpc_tx_data(call, sp->hdr.seq, serial, |
396 | whdr.flags, retrans, true); | ||
397 | goto done; | ||
397 | } | 398 | } |
398 | } | 399 | } |
399 | 400 | ||
400 | trace_rxrpc_tx_data(call, sp->hdr.seq, serial, whdr.flags, | 401 | trace_rxrpc_tx_data(call, sp->hdr.seq, serial, whdr.flags, retrans, |
401 | retrans, lost); | 402 | false); |
402 | if (lost) | ||
403 | goto done; | ||
404 | 403 | ||
405 | /* send the packet with the don't fragment bit set if we currently | 404 | /* send the packet with the don't fragment bit set if we currently |
406 | * think it's small enough */ | 405 | * think it's small enough */ |