Hi Richard, On Wed Jun 24 2020, Richard Cochran wrote: > On Thu, Jun 18, 2020 at 08:40:23AM +0200, Kurt Kanzenbach wrote: > >> diff --git a/drivers/net/dsa/hirschmann/hellcreek.h b/drivers/net/dsa/hirschmann/hellcreek.h >> index a08a10cb5ab7..2d4422fd2567 100644 >> --- a/drivers/net/dsa/hirschmann/hellcreek.h >> +++ b/drivers/net/dsa/hirschmann/hellcreek.h >> @@ -234,10 +234,17 @@ struct hellcreek_fdb_entry { >> struct hellcreek { >> struct device *dev; >> struct dsa_switch *ds; >> + struct ptp_clock *ptp_clock; >> + struct ptp_clock_info ptp_clock_info; >> struct hellcreek_port ports[4]; >> + struct delayed_work overflow_work; >> spinlock_t reg_lock; /* Switch IP register lock */ >> + spinlock_t ptp_lock; /* PTP IP register lock */ > > Why use a spin lock and not a mutex? No particular reason. Mutex will also work. >> + hellcreek->ptp_clock = ptp_clock_register(&hellcreek->ptp_clock_info, >> + hellcreek->dev); >> + if (IS_ERR(hellcreek->ptp_clock)) >> + return PTR_ERR(hellcreek->ptp_clock); > > The ptp_clock_register() can also return NULL: > > * 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. > I see, thanks. I guess we could add the missing NULL checks to remove() and get_ts_info() to handle that case gracefully. Thanks, Kurt
Attachment:
signature.asc
Description: PGP signature