2021-05-26 00:25:19

by Peter Geis

[permalink] [raw]
Subject: [PATCH v2 0/2] fixes for yt8511 phy driver

The Intel clang bot caught a few uninitialized variables in the new
Motorcomm driver. While investigating the issue, it was found that the
driver would have unintended effects when used in an unsupported mode.

Fixed the uninitialized ret variable and abort loading the driver in
unsupported modes.

Thank you to the Intel clang bot for catching these.

Changelog:
V2:
- fix variable order
- add Andrew Lunn's reviewed-by tags

Peter Geis (2):
net: phy: fix yt8511 clang uninitialized variable warning
net: phy: abort loading yt8511 driver in unsupported modes

drivers/net/phy/motorcomm.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)

--
2.25.1


2021-05-26 00:28:05

by Peter Geis

[permalink] [raw]
Subject: [PATCH v2 1/2] net: phy: fix yt8511 clang uninitialized variable warning

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 <[email protected]>
Reviewed-by: Andrew Lunn <[email protected]>
Signed-off-by: Peter Geis <[email protected]>
---
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..68cd19540c67 100644
--- a/drivers/net/phy/motorcomm.c
+++ b/drivers/net/phy/motorcomm.c
@@ -50,8 +50,8 @@ static int yt8511_write_page(struct phy_device *phydev, int page)

static int yt8511_config_init(struct phy_device *phydev)
{
+ int oldpage, ret = 0;
unsigned int ge, fe;
- int ret, oldpage;

/* set clock mode to 125mhz */
oldpage = phy_select_page(phydev, YT8511_EXT_CLK_GATE);
--
2.25.1

2021-05-26 20:34:12

by Jakub Kicinski

[permalink] [raw]
Subject: Re: [PATCH v2 0/2] fixes for yt8511 phy driver

On Tue, 25 May 2021 16:33:12 -0400 Peter Geis wrote:
> The Intel clang bot caught a few uninitialized variables in the new
> Motorcomm driver. While investigating the issue, it was found that the
> driver would have unintended effects when used in an unsupported mode.
>
> Fixed the uninitialized ret variable and abort loading the driver in
> unsupported modes.
>
> Thank you to the Intel clang bot for catching these.

Fixes tag need work, the hashes don't match the ones in net-next.

2021-05-26 20:54:20

by Peter Geis

[permalink] [raw]
Subject: Re: [PATCH v2 0/2] fixes for yt8511 phy driver

On Wed, May 26, 2021 at 3:27 PM Jakub Kicinski <[email protected]> wrote:
>
> On Tue, 25 May 2021 16:33:12 -0400 Peter Geis wrote:
> > The Intel clang bot caught a few uninitialized variables in the new
> > Motorcomm driver. While investigating the issue, it was found that the
> > driver would have unintended effects when used in an unsupported mode.
> >
> > Fixed the uninitialized ret variable and abort loading the driver in
> > unsupported modes.
> >
> > Thank you to the Intel clang bot for catching these.
>
> Fixes tag need work, the hashes don't match the ones in net-next.

It seems when I asked git for the hash for that patch, it grabbed my
original patch which was against linux-next.
Apologies for the confusion.