[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210702003936.22m2rz7sajkwusaa@skbuf>
Date: Fri, 2 Jul 2021 03:39:36 +0300
From: Vladimir Oltean <olteanv@...il.com>
To: Richard Cochran <richardcochran@...il.com>,
Jonathan Lemon <jonathan.lemon@...il.com>
Cc: netdev@...r.kernel.org, kernel-team@...com
Subject: Re: [PATCH] ptp: Set lookup cookie when creating a PTP PPS source.
On Mon, Jun 28, 2021 at 04:38:35PM -0700, Richard Cochran wrote:
> On Mon, Jun 28, 2021 at 11:25:33AM -0700, Jonathan Lemon wrote:
> > When creating a PTP device, the configuration block allows
> > creation of an associated PPS device. However, there isn't
> > any way to associate the two devices after creation.
> >
> > Set the PPS cookie, so pps_lookup_dev(ptp) performs correctly.
>
> Setting lookup_cookie is harmless, AFAICT, but I wonder about the use
> case. The doc for pps_lookup_dev() says,
Harmless you say?
Let's look at the code in a larger context:
struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info,
struct device *parent)
{
struct ptp_clock *ptp;
...
ptp = kzalloc(...);
...
ptp->info = info;
...
if (ptp->info->do_aux_work) {
...
+ ptp->pps_source->lookup_cookie = ptp;
}
/* Register a new PPS source. */
if (info->pps) {
struct pps_source_info pps;
...
ptp->pps_source = pps_register_source(&pps, PTP_PPS_DEFAULTS);
...
}
Notice anything out of the ordinary?
Like perhaps the fact that ptp->pps_source is an arbitrary NULL pointer
at the time the assignment to ->lookup_cookie is being made, because it
is being created later?
How on earth is this patch supposed to work?
Powered by blists - more mailing lists