On Thu Nov 12 2020, YueHaibing wrote: > drivers/net/dsa/sja1105/sja1105_ptp.c:869 sja1105_ptp_clock_register() warn: passing zero to 'PTR_ERR' > > ptp_clock_register() returns ERR_PTR() and never returns > NULL. The NULL test should be removed. Which is not true. From the documentation: * 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. Please, always Cc Richard for PTP patches. Actually you can have a look at this discussion here: https://lkml.kernel.org/netdev/1605086686-5140-1-git-send-email-wangqing@vivo.com/ > > Fixes: bb77f36ac21d ("net: dsa: sja1105: Add support for the PTP clock") > Signed-off-by: YueHaibing > --- > drivers/net/dsa/sja1105/sja1105_ptp.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/net/dsa/sja1105/sja1105_ptp.c b/drivers/net/dsa/sja1105/sja1105_ptp.c > index 1b90570b257b..1e41d491c854 100644 > --- a/drivers/net/dsa/sja1105/sja1105_ptp.c > +++ b/drivers/net/dsa/sja1105/sja1105_ptp.c > @@ -865,7 +865,7 @@ int sja1105_ptp_clock_register(struct dsa_switch *ds) > spin_lock_init(&tagger_data->meta_lock); > > ptp_data->clock = ptp_clock_register(&ptp_data->caps, ds->dev); > - if (IS_ERR_OR_NULL(ptp_data->clock)) > + if (IS_ERR(ptp_data->clock)) When you do this, you'll have to make sure that the driver handles the NULL case "gracefully". Thanks, Kurt