* [PATCH net] cxgb4: ptp_clock_register() returns error pointers
@ 2017-07-11 14:24 Ganesh Goudar
2017-07-11 20:20 ` Richard Cochran
0 siblings, 1 reply; 2+ messages in thread
From: Ganesh Goudar @ 2017-07-11 14:24 UTC (permalink / raw)
To: netdev, davem; +Cc: dan.carpenter, atul.gupta, Ganesh Goudar, Richard Cochran
Check ptp_clock_register() return not only for NULL but
also for error pointers.
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>
---
drivers/net/ethernet/chelsio/cxgb4/cxgb4_ptp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ptp.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ptp.c
index 50517cf..06c0de4 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ptp.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ptp.c
@@ -441,7 +441,7 @@ 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)) {
dev_err(adapter->pdev_dev,
"PTP %s Clock registration has failed\n", __func__);
return;
--
2.1.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH net] cxgb4: ptp_clock_register() returns error pointers
2017-07-11 14:24 [PATCH net] cxgb4: ptp_clock_register() returns error pointers Ganesh Goudar
@ 2017-07-11 20:20 ` Richard Cochran
0 siblings, 0 replies; 2+ messages in thread
From: Richard Cochran @ 2017-07-11 20:20 UTC (permalink / raw)
To: Ganesh Goudar; +Cc: netdev, davem, dan.carpenter, atul.gupta
On Tue, Jul 11, 2017 at 07:54:38PM +0530, Ganesh Goudar wrote:
> diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ptp.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ptp.c
> index 50517cf..06c0de4 100644
> --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ptp.c
> +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ptp.c
> @@ -441,7 +441,7 @@ 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)) {
But here you also need
adapter->ptp_clock = NULL;
> dev_err(adapter->pdev_dev,
> "PTP %s Clock registration has failed\n", __func__);
> return;
because later on you have:
void cxgb4_ptp_stop(struct adapter *adapter)
{
...
if (adapter->ptp_clock) {
ptp_clock_unregister(adapter->ptp_clock);
adapter->ptp_clock = NULL;
}
}
Thanks,
Richard
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-07-11 20:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-11 14:24 [PATCH net] cxgb4: ptp_clock_register() returns error pointers Ganesh Goudar
2017-07-11 20:20 ` Richard Cochran
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox