[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20170710192354.dyd2gr5wt6m7wksf@localhost.localdomain>
Date: Mon, 10 Jul 2017 21:23:54 +0200
From: Richard Cochran <richardcochran@...il.com>
To: Atul Gupta <atul.gupta@...lsio.com>
Cc: netdev@...r.kernel.org, davem@...emloft.net, ganeshgr@...lsio.com
Subject: Re: [PATCH net-next 2/3] cxgb4: Add PTP Hardware Clock (PHC) support
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
Powered by blists - more mailing lists