aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGanesh Goudar <ganeshgr@chelsio.com>2017-07-13 09:06:50 -0400
committerDavid S. Miller <davem@davemloft.net>2017-07-14 11:18:51 -0400
commit40fbbce007cb458da4c15cbf53beacf6b755cedc (patch)
tree8da76ad10249fd6156c9f85f580c59f4b0ee69fb
parent1e4babee70a2e2d8f9e0da06f013563b0e26f654 (diff)
cxgb4: ptp_clock_register() returns error pointers
Check ptp_clock_register() return not only for NULL but also for error pointers, and also nullify adapter->ptp_clock if ptp_clock_register() fails. Fixes: 9c33e4208bce ("cxgb4: Add PTP Hardware Clock (PHC) support") Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Cc: Richard Cochran <richardcochran@gmail.com> Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/cxgb4_ptp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ptp.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ptp.c
index 50517cfd9671..9f9d6cae39d5 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ptp.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ptp.c
@@ -441,7 +441,8 @@ void cxgb4_ptp_init(struct adapter *adapter)
441 441
442 adapter->ptp_clock = ptp_clock_register(&adapter->ptp_clock_info, 442 adapter->ptp_clock = ptp_clock_register(&adapter->ptp_clock_info,
443 &adapter->pdev->dev); 443 &adapter->pdev->dev);
444 if (!adapter->ptp_clock) { 444 if (IS_ERR_OR_NULL(adapter->ptp_clock)) {
445 adapter->ptp_clock = NULL;
445 dev_err(adapter->pdev_dev, 446 dev_err(adapter->pdev_dev,
446 "PTP %s Clock registration has failed\n", __func__); 447 "PTP %s Clock registration has failed\n", __func__);
447 return; 448 return;