linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: richardcochran@gmail.com (Richard Cochran)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH net-next v5 1/2] net: add support for Cavium PTP coprocessor
Date: Tue, 12 Dec 2017 09:12:36 -0800	[thread overview]
Message-ID: <20171212171236.36yn4ljbnm2c2zqf@localhost> (raw)
In-Reply-To: <d1e2faeb-ba5e-f324-efb5-da64e4b3ced3@cavium.com>

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

  reply	other threads:[~2017-12-12 17:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-11 14:14 [PATCH net-next v5 0/2] net: thunderx: add support for PTP clock Aleksey Makarov
2017-12-11 14:14 ` [PATCH net-next v5 1/2] net: add support for Cavium PTP coprocessor Aleksey Makarov
2017-12-11 22:59   ` Richard Cochran
2017-12-12  9:41     ` Aleksey Makarov
2017-12-12 17:12       ` Richard Cochran [this message]
2017-12-11 14:14 ` [PATCH net-next v5 2/2] net: thunderx: add timestamping support Aleksey Makarov
2017-12-11 23:32   ` Richard Cochran
2018-01-08 17:12     ` Aleksey Makarov
2017-12-11 23:36   ` Richard Cochran
2017-12-12 19:47     ` Joe Perches
2017-12-11 14:33 ` [PATCH net-next v5 0/2] net: thunderx: add support for PTP clock Philippe Ombredanne

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171212171236.36yn4ljbnm2c2zqf@localhost \
    --to=richardcochran@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).