Subject: Re: [PATCH net-next v4 6/8] net: phy: mscc: timestamping and PHC support

From: Richard Cochran <[email-masked]>
Date: Thu, 25 Jun 2020 06:22:26 -0700

On Tue, Jun 23, 2020 at 04:30:12PM +0200, Antoine Tenart wrote:
> @@ -978,9 +1483,32 @@ static int __vsc8584_init_ptp(struct phy_device *phydev)
>  
>  	vsc85xx_ts_eth_cmp1_sig(phydev);
>  
> +	vsc8531->mii_ts.rxtstamp = vsc85xx_rxtstamp;
> +	vsc8531->mii_ts.txtstamp = vsc85xx_txtstamp;
> +	vsc8531->mii_ts.hwtstamp = vsc85xx_hwtstamp;
> +	vsc8531->mii_ts.ts_info  = vsc85xx_ts_info;
> +	phydev->mii_ts = &vsc8531->mii_ts;
> +
> +	memcpy(&vsc8531->ptp->caps, &vsc85xx_clk_caps, sizeof(vsc85xx_clk_caps));
> +
> +	vsc8531->ptp->ptp_clock = ptp_clock_register(&vsc8531->ptp->caps,
> +						     &phydev->mdio.dev);
> +	if (IS_ERR(vsc8531->ptp->ptp_clock))
> +		return PTR_ERR(vsc8531->ptp->ptp_clock);

The ptp_clock_register() method can also return NULL:

 * Returns a valid pointer on success or PTR_ERR on failure.  If PHC
 * support is missing at the configuration level, this function
 * returns NULL, and drivers are expected to gracefully handle that
 * case separately.

Thanks,
Richard