[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <159309233393.397581.16273630291558095966@kwain>
Date: Thu, 25 Jun 2020 15:38:54 +0200
From: Antoine Tenart <antoine.tenart@...tlin.com>
To: Richard Cochran <richardcochran@...il.com>
Cc: davem@...emloft.net, andrew@...n.ch, f.fainelli@...il.com,
hkallweit1@...il.com, alexandre.belloni@...tlin.com,
UNGLinuxDriver@...rochip.com, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, thomas.petazzoni@...tlin.com,
allan.nielsen@...rochip.com, foss@...il.net
Subject: Re: [PATCH net-next v4 6/8] net: phy: mscc: timestamping and PHC support
Hello Richard,
Quoting Richard Cochran (2020-06-25 15:22:26)
> 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.
If ptp_clock_register returns NULL because PHC support is missing, the
clock won't be exported. Beside that, I don't think we can do much in
the error path, so this should be safe.
Thanks,
Antoine
--
Antoine Ténart, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Powered by blists - more mailing lists