From: Andrew Lunn <andrew@lunn.ch>
To: Peter Geis <pgwipeout@gmail.com>
Cc: Heiner Kallweit <hkallweit1@gmail.com>,
Russell King <linux@armlinux.org.uk>,
"David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Nathan Chancellor <nathan@kernel.org>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
clang-built-linux@googlegroups.com,
kernel test robot <lkp@intel.com>
Subject: Re: [PATCH 1/2] net: phy: fix yt8511 clang uninitialized variable warning
Date: Tue, 25 May 2021 15:01:59 +0200 [thread overview]
Message-ID: <YKz1R2+ivmRsjAoL@lunn.ch> (raw)
In-Reply-To: <20210525122615.3972574-2-pgwipeout@gmail.com>
On Tue, May 25, 2021 at 08:26:14AM -0400, Peter Geis wrote:
> clang doesn't preinitialize variables. If phy_select_page failed and
> returned an error, phy_restore_page would be called with `ret` being
> uninitialized.
> Even though phy_restore_page won't use `ret` in this scenario,
> initialize `ret` to silence the warning.
>
> Fixes: b1b41c047f73 ("net: phy: add driver for Motorcomm yt8511 phy")
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Peter Geis <pgwipeout@gmail.com>
> ---
> drivers/net/phy/motorcomm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/phy/motorcomm.c b/drivers/net/phy/motorcomm.c
> index 796b68f4b499..5795f446c528 100644
> --- a/drivers/net/phy/motorcomm.c
> +++ b/drivers/net/phy/motorcomm.c
> @@ -51,7 +51,7 @@ static int yt8511_write_page(struct phy_device *phydev, int page)
> static int yt8511_config_init(struct phy_device *phydev)
> {
> unsigned int ge, fe;
> - int ret, oldpage;
> + int oldpage, ret = 0;
Please keep to reverse Christmas tree.
With that fixed:
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
next prev parent reply other threads:[~2021-05-25 13:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-25 12:26 [PATCH 0/2] fixes for yt8511 phy driver Peter Geis
2021-05-25 12:26 ` [PATCH 1/2] net: phy: fix yt8511 clang uninitialized variable warning Peter Geis
2021-05-25 13:01 ` Andrew Lunn [this message]
2021-05-25 13:11 ` Peter Geis
2021-05-25 13:59 ` Andrew Lunn
2021-05-25 12:26 ` [PATCH 2/2] net: phy: abort loading yt8511 driver in unsupported modes Peter Geis
2021-05-25 13:03 ` Andrew Lunn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YKz1R2+ivmRsjAoL@lunn.ch \
--to=andrew@lunn.ch \
--cc=clang-built-linux@googlegroups.com \
--cc=davem@davemloft.net \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=lkp@intel.com \
--cc=nathan@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pgwipeout@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox