Subject: Re: [PATCH] net: phy: add driver for Motorcomm yt8511 phy

From: Russell King - ARM Linux admin <[email-masked]>
Date: Tue, 11 May 2021 22:56:44 +0100

Hi,

On Tue, May 11, 2021 at 05:46:06PM -0400, Peter Geis wrote:
> +static int yt8511_config_init(struct phy_device *phydev)
> +{
> +	int ret, val, oldpage;
> +
> +	/* set clock mode to 125mhz */
> +	oldpage = phy_select_page(phydev, YT8511_EXT_CLK_GATE);
> +	if (oldpage < 0)
> +		goto err_restore_page;
> +
> +	val = __phy_read(phydev, YT8511_PAGE);
> +	val |= (YT8511_CLK_125M);
> +	ret = __phy_write(phydev, YT8511_PAGE, val);

Please consider __phy_modify(), and handle any error it returns.

> +
> +	/* disable auto sleep */
> +	ret = __phy_write(phydev, YT8511_PAGE_SELECT, YT8511_EXT_SLEEP_CTRL);

Please consider handling a failure to write here.

> +	val = __phy_read(phydev, YT8511_PAGE);
> +	val &= (~BIT(15));
> +	ret = __phy_write(phydev, YT8511_PAGE, val);

Also a use for __phy_modify().

> +
> +err_restore_page:
> +	return phy_restore_page(phydev, oldpage, ret);
> +}
> +
> +static struct phy_driver motorcomm_phy_drvs[] = {
> +	{
> +		PHY_ID_MATCH_EXACT(PHY_ID_YT8511),
> +		.name		= "YT8511 Gigabit Ethernet",
> +		.config_init	= &yt8511_config_init,

Please drop the '&' here, it's unnecessary.

Thanks.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!