[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220527094939.qgtl3s7frlgx3yvf@localhost.localdomain>
Date: Fri, 27 May 2022 09:50:47 +0000
From: Viorel Suman <viorel.suman@....com>
To: Jakub Kicinski <kuba@...nel.org>
CC: "Viorel Suman (OSS)" <viorel.suman@....nxp.com>,
Andrew Lunn <andrew@...n.ch>,
Heiner Kallweit <hkallweit1@...il.com>,
Russell King <linux@...linux.org.uk>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Paolo Abeni <pabeni@...hat.com>, Luo Jie <luoj@...eaurora.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
dl-linux-imx <linux-imx@....com>
Subject: Re: [PATCH] net: phy: at803x: disable WOL at probe
On 22-05-26 21:00:44, Jakub Kicinski wrote:
> On Wed, 25 May 2022 13:36:57 +0300 Viorel Suman (OSS) wrote:
> > diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c
> > index 73926006d319..6277d1b1d814 100644
> > --- a/drivers/net/phy/at803x.c
> > +++ b/drivers/net/phy/at803x.c
> > @@ -443,10 +443,10 @@ static int at803x_set_wol(struct phy_device *phydev,
> > AT803X_LOC_MAC_ADDR_0_15_OFFSET,
> > };
> >
> > - if (!ndev)
> > - return -ENODEV;
> > -
> > if (wol->wolopts & WAKE_MAGIC) {
> > + if (!ndev)
> > + return -ENODEV;
>
> Please move the ndev variable into the scope.
> It'll make it clear that it can't be used elsewhere
> in this function.
Thank you for review, done in v2.
>
> > mac = (const u8 *) ndev->dev_addr;
> >
> > if (!is_valid_ether_addr(mac))
> > @@ -857,6 +857,9 @@ static int at803x_probe(struct phy_device *phydev)
> > if (phydev->drv->phy_id == ATH8031_PHY_ID) {
> > int ccr = phy_read(phydev, AT803X_REG_CHIP_CONFIG);
> > int mode_cfg;
> > + struct ethtool_wolinfo wol = {
> > + .wolopts = 0,
> > + };
> >
> > if (ccr < 0)
> > goto err;
> > @@ -872,6 +875,13 @@ static int at803x_probe(struct phy_device *phydev)
> > priv->is_fiber = true;
> > break;
> > }
> > +
> > + /* Disable WOL by default */
> > + ret = at803x_set_wol(phydev, &wol);
> > + if (ret < 0) {
> > + phydev_err(phydev, "failed to disable WOL on probe: %d\n", ret);
> > + return ret;
>
> Don't you need to goto err; here?
Missed err section indeed, thanks. Fixed in v2.
>
> > + }
> > }
> >
> > return 0;
Powered by blists - more mailing lists