[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 12 Dec 2017 09:12:36 -0800
From: Richard Cochran <richardcochran@...il.com>
To: Aleksey Makarov <aleksey.makarov@...ium.com>
Cc: netdev@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org,
"Goutham, Sunil" <Sunil.Goutham@...ium.com>,
Radoslaw Biernacki <rad@...ihalf.com>,
Robert Richter <rric@...nel.org>,
David Daney <ddaney@...iumnetworks.com>,
Philippe Ombredanne <pombredanne@...b.com>
Subject: Re: [PATCH net-next v5 1/2] net: add support for Cavium PTP
coprocessor
On Tue, Dec 12, 2017 at 12:41:35PM +0300, Aleksey Makarov wrote:
> If ptp_clock_register() returns NULL, the device is still paired with the driver,
> but the driver is not registered in the PTP core. When ethernet driver needs
> the reference to this cavium PTP driver, it calls cavium_ptp_get() that checks
> if ptp->ptp_clock is NULL and, if so, returns -ENODEV.
The pointer clock->ptp_clock can be NULL.
Yet you de-reference it here:
> +static void cavium_ptp_remove(struct pci_dev *pdev)
> +{
> + struct cavium_ptp *clock = pci_get_drvdata(pdev);
> + u64 clock_cfg;
> +
> + pci_set_drvdata(pdev, NULL);
> +
> + ptp_clock_unregister(clock->ptp_clock);
> +
> + clock_cfg = readq(clock->reg_base + PTP_CLOCK_CFG);
> + clock_cfg &= ~PTP_CLOCK_CFG_PTP_EN;
> + writeq(clock_cfg, clock->reg_base + PTP_CLOCK_CFG);
> +}
and here:
> +static inline int cavium_ptp_clock_index(struct cavium_ptp *clock)
> +{
> + return ptp_clock_index(clock->ptp_clock);
> +}
That needs to be fixed.
Thanks,
Richard
Powered by blists - more mailing lists