Skip to content

Commit 155d940

Browse files
Wei Yongjundavem330
authored andcommitted
sfc: fix return value check in efx_ptp_probe_channel()
In case of error, the function ptp_clock_register() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR(). Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Reviewed-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 228fb08 commit 155d940

File tree

1 file changed

+3
-1
lines changed
  • drivers/net/ethernet/sfc

1 file changed

+3
-1
lines changed

drivers/net/ethernet/sfc/ptp.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -912,8 +912,10 @@ static int efx_ptp_probe_channel(struct efx_channel *channel)
912912

913913
ptp->phc_clock = ptp_clock_register(&ptp->phc_clock_info,
914914
&efx->pci_dev->dev);
915-
if (!ptp->phc_clock)
915+
if (IS_ERR(ptp->phc_clock)) {
916+
rc = PTR_ERR(ptp->phc_clock);
916917
goto fail3;
918+
}
917919

918920
INIT_WORK(&ptp->pps_work, efx_ptp_pps_worker);
919921
ptp->pps_workwq = create_singlethread_workqueue("sfc_pps");

0 commit comments

Comments
 (0)