Subject: Re: [PATCH v2 net-next 01/12] net: aquantia: PTP skeleton declarations and callbacks

From: Richard Cochran <[email-masked]>
Date: Sat, 12 Oct 2019 11:56:09 -0700

On Tue, Oct 08, 2019 at 10:56:36AM +0000, Igor Russkikh wrote:

> +static struct ptp_clock_info aq_ptp_clock = {
> +	.owner		= THIS_MODULE,
> +	.name		= "atlantic ptp",
> +	.n_ext_ts	= 0,
> +	.pps		= 0,
> +	.n_per_out     = 0,
> +	.n_pins        = 0,
> +	.pin_config    = NULL,
> +};

> +int aq_ptp_init(struct aq_nic_s *aq_nic, unsigned int idx_vec)
> +{
> +	struct hw_atl_utils_mbox mbox;
> +	struct ptp_clock *clock;
> +	struct aq_ptp_s *aq_ptp;
> +	int err = 0;
> +
> +	hw_atl_utils_mpi_read_stats(aq_nic->aq_hw, &mbox);
> +
> +	if (!(mbox.info.caps_ex & BIT(CAPS_EX_PHY_PTP_EN))) {
> +		aq_nic->aq_ptp = NULL;
> +		return 0;
> +	}
> +
> +	aq_ptp = kzalloc(sizeof(*aq_ptp), GFP_KERNEL);
> +	if (!aq_ptp) {
> +		err = -ENOMEM;
> +		goto err_exit;
> +	}
> +
> +	aq_ptp->aq_nic = aq_nic;
> +
> +	aq_ptp->ptp_info = aq_ptp_clock;
> +	clock = ptp_clock_register(&aq_ptp->ptp_info, &aq_nic->ndev->dev);

You register a ptp_info with NULL pointers instead of callbacks.  That
means this patch will cause an Oops.  Incremental patch series are
nice, but be sure that every patch really works.  The patch that
introduces the call to ptp_clock_register() should come only when
ptp_info is populated with callbacks.

Thanks,
Richard