linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: cpts: Condition WARN_ON on PTP_1588_CLOCK
@ 2020-04-16  8:56 Clay McClure
  2020-04-16 11:11 ` Grygorii Strashko
  0 siblings, 1 reply; 12+ messages in thread
From: Clay McClure @ 2020-04-16  8:56 UTC (permalink / raw)
  Cc: Clay McClure, David S. Miller, Grygorii Strashko, Sekhar Nori,
	Richard Cochran, netdev, linux-kernel

CPTS_MOD merely implies PTP_1588_CLOCK; it is possible to build cpts
without PTP clock support. In that case, ptp_clock_register() returns
NULL and we should not WARN_ON(cpts->clock) when downing the interface.
The ptp_*() functions are stubbed without PTP_1588_CLOCK, so it's safe
to pass them a null pointer.

Signed-off-by: Clay McClure <clay@daemons.net>
---
 drivers/net/ethernet/ti/cpts.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/ti/cpts.c b/drivers/net/ethernet/ti/cpts.c
index fd214f8730a9..daf4505f4a70 100644
--- a/drivers/net/ethernet/ti/cpts.c
+++ b/drivers/net/ethernet/ti/cpts.c
@@ -646,7 +646,7 @@ EXPORT_SYMBOL_GPL(cpts_register);
 
 void cpts_unregister(struct cpts *cpts)
 {
-	if (WARN_ON(!cpts->clock))
+	if (IS_REACHABLE(PTP_1588_CLOCK) && WARN_ON(!cpts->clock))
 		return;
 
 	ptp_clock_unregister(cpts->clock);
-- 
2.20.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2020-04-26  2:42 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-16  8:56 [PATCH] net: cpts: Condition WARN_ON on PTP_1588_CLOCK Clay McClure
2020-04-16 11:11 ` Grygorii Strashko
2020-04-20  9:36   ` Clay McClure
2020-04-20 14:38     ` Arnd Bergmann
2020-04-20 17:00       ` Richard Cochran
2020-04-20 18:57         ` Arnd Bergmann
2020-04-20 21:18           ` Richard Cochran
2020-04-20 21:21             ` Arnd Bergmann
2020-04-20 21:34               ` Richard Cochran
2020-04-20 21:42                 ` Arnd Bergmann
2020-04-22 11:16                   ` Grygorii Strashko
2020-04-26  2:41                     ` Clay McClure

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).