Message ID | 1604719703-31930-1-git-send-email-wangqing@vivo.com |
---|---|
State | Rejected |
Delegated to: | David Miller |
Headers | show |
Series | pcp_clock: return EOPNOTSUPP if !CONFIG_PTP_1588_CLOCK | expand |
Context | Check | Description |
---|---|---|
jkicinski/tree_selection | success | Not a local patch |
On Sat, Nov 07, 2020 at 11:28:23AM +0800, Wang Qing wrote: > 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. NAK. Drivers must use the documented interface. Thanks, Richard
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,
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(-)