forked from Minki/linux
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: 9c33e4208b
("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>
This commit is contained in:
parent
1e4babee70
commit
40fbbce007
@ -441,7 +441,8 @@ void cxgb4_ptp_init(struct adapter *adapter)
|
||||
|
||||
adapter->ptp_clock = ptp_clock_register(&adapter->ptp_clock_info,
|
||||
&adapter->pdev->dev);
|
||||
if (!adapter->ptp_clock) {
|
||||
if (IS_ERR_OR_NULL(adapter->ptp_clock)) {
|
||||
adapter->ptp_clock = NULL;
|
||||
dev_err(adapter->pdev_dev,
|
||||
"PTP %s Clock registration has failed\n", __func__);
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user