[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wjJ-nr87H_o8y=Gx=DJYPTkxtXz_c=pj_GNdL+XRUMNgQ@mail.gmail.com>
Date: Mon, 6 Sep 2021 09:39:51 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Naresh Kamboju <naresh.kamboju@...aro.org>,
Vlad Buslov <vladbu@...dia.com>
Cc: open list <linux-kernel@...r.kernel.org>,
clang-built-linux <clang-built-linux@...glegroups.com>,
lkft-triage@...ts.linaro.org, Netdev <netdev@...r.kernel.org>,
Nathan Chancellor <natechancellor@...il.com>,
Nick Desaulniers <ndesaulniers@...gle.com>,
"David S. Miller" <davem@...emloft.net>
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@...aro.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
Powered by blists - more mailing lists