* [PATCH] pcp_clock: return EOPNOTSUPP if !CONFIG_PTP_1588_CLOCK
@ 2020-11-07 3:28 Wang Qing
2020-11-07 14:56 ` Richard Cochran
0 siblings, 1 reply; 2+ messages in thread
From: Wang Qing @ 2020-11-07 3:28 UTC (permalink / raw)
To: Richard Cochran, netdev, linux-kernel; +Cc: Wang Qing
pcp_clock_register() is checked with IS_ERR(), and will crash if !PTP,
change return value to ERR_PTR(-EOPNOTSUPP) for the !CONFIG_PTP_1588_CLOCK
and so question resolved.
Signed-off-by: Wang Qing <wangqing@vivo.com>
---
include/linux/ptp_clock_kernel.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/ptp_clock_kernel.h b/include/linux/ptp_clock_kernel.h
index d3e8ba5..05db40c
--- a/include/linux/ptp_clock_kernel.h
+++ b/include/linux/ptp_clock_kernel.h
@@ -276,7 +276,7 @@ void ptp_cancel_worker_sync(struct ptp_clock *ptp);
#else
static inline struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info,
struct device *parent)
-{ return NULL; }
+{ return ERR_PTR(-EOPNOTSUPP); }
static inline int ptp_clock_unregister(struct ptp_clock *ptp)
{ return 0; }
static inline void ptp_clock_event(struct ptp_clock *ptp,
--
2.7.4
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-11-07 14:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-07 3:28 [PATCH] pcp_clock: return EOPNOTSUPP if !CONFIG_PTP_1588_CLOCK Wang Qing
2020-11-07 14:56 ` Richard Cochran
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®