On Tue, Jul 04, 2017 at 04:46:21PM +0530, Atul Gupta wrote: > +/** > + * cxgb4_ptp_init - initialize PTP for devices which support it > + * @adapter: board private structure > + * > + * This function performs the required steps for enabling PTP support. > + */ > +void cxgb4_ptp_init(struct adapter *adapter) > +{ > + struct timespec64 now; > + /* no need to create a clock device if we already have one */ > + if (!IS_ERR_OR_NULL(adapter->ptp_clock)) > + return; > + > + adapter->ptp_tx_skb = NULL; > + adapter->ptp_clock_info = cxgb4_ptp_clock_info; > + spin_lock_init(&adapter->ptp_lock); > + > + adapter->ptp_clock = ptp_clock_register(&adapter->ptp_clock_info, > + &adapter->pdev->dev); > + if (!adapter->ptp_clock) { > + dev_err(adapter->pdev_dev, > + "PTP %s Clock registration has failed\n", __func__); > + return; > + }
This is wrong. To quote the header file: /** * ptp_clock_register() - register a PTP hardware clock driver * * @info: Structure describing the new clock. * @parent: Pointer to the parent device of the new clock. * * 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. */ As this has already been merged, please submit a patch to properly handle both PTR_ERR and NULL. Thanks, Richard