Messages in this thread | | | From | Linus Torvalds <> | Date | Mon, 6 Sep 2021 09:39:51 -0700 | Subject | Re: bridge.c:157:11: error: variable 'err' is used uninitialized whenever 'if' condition is false |
| |
On Mon, Sep 6, 2021 at 2:11 AM Naresh Kamboju <naresh.kamboju@linaro.org> wrote: > > drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c:157:11: error: > variable 'err' is used uninitialized whenever 'if' condition is false
That compiler warning (now error) seems to be entirely valid.
That's a
if (..) else if (..)
and if neither are valid then the code will return an uninitialized 'err'.
It's possible the two conditionals are guaranteed to cover all cases, but as the compiler says, in that case the "if" in the else clause is pointless and should be removed.
But it does look like 'ret' should probably just be initialized to 0.
Linus
| |