lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220906140934.vtxddfvtdlom563l@skbuf>
Date:   Tue, 6 Sep 2022 14:09:35 +0000
From:   Ioana Ciornei <ioana.ciornei@....com>
To:     Andrew Lunn <andrew@...n.ch>
CC:     "davem@...emloft.net" <davem@...emloft.net>,
        "edumazet@...gle.com" <edumazet@...gle.com>,
        "kuba@...nel.org" <kuba@...nel.org>,
        "pabeni@...hat.com" <pabeni@...hat.com>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "hkallweit1@...il.com" <hkallweit1@...il.com>,
        "linux@...linux.org.uk" <linux@...linux.org.uk>,
        "f.fainelli@...il.com" <f.fainelli@...il.com>
Subject: Re: [PATCH v2 net] net: phy: aquantia: wait for the suspend/resume
 operations to finish

On Tue, Sep 06, 2022 at 03:11:06PM +0200, Andrew Lunn wrote:
> > +static int aqr107_wait_processor_intensive_op(struct phy_device *phydev)
> > +{
> > +	int val, err;
> > +
> > +	/* The datasheet notes to wait at least 1ms after issuing a
> > +	 * processor intensive operation before checking.
> > +	 * We cannot use the 'sleep_before_read' parameter of read_poll_timeout
> > +	 * because that just determines the maximum time slept, not the minimum.
> > +	 */
> > +	usleep_range(1000, 5000);
> > +
> > +	err = phy_read_mmd_poll_timeout(phydev, MDIO_MMD_VEND1,
> > +					VEND1_GLOBAL_GEN_STAT2, val,
> > +					!(val & VEND1_GLOBAL_GEN_STAT2_OP_IN_PROG),
> > +					AQR107_OP_IN_PROG_SLEEP,
> > +					AQR107_OP_IN_PROG_TIMEOUT, false);
> > +	if (err) {
> > +		phydev_err(phydev, "timeout: processor-intensive MDIO operation\n");
> > +		return err;
> > +	}
> > +
> > +	return 0;
> 
> nitpick: You could simplify this to:
> 
> > +	if (err)
> > +		phydev_err(phydev, "timeout: processor-intensive MDIO operation\n");
> > +
> > +	return err;
> > +}
> 

I would prefer to leave it as it is. I know that in this particular case
we could spare the braces but in general I am not so keen of this form
since if there is more to add to the function, it would force us to also
re-add the return statement.

> Reviewed-by: Andrew Lunn <andrew@...n.ch>
> 
>     Andrew

Thanks,
Ioana

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ