diff mbox

[4/5] net: sfc: fix return value check in efx_ptp_probe_channel().

Message ID 1355271894-5284-5-git-send-email-tipecaml@gmail.com
State Awaiting Upstream, archived
Delegated to: David Miller
Headers show

Commit Message

Cyril Roelandt Dec. 12, 2012, 12:24 a.m. UTC
The ptp_clock_register() returns ERR_PTR() and never returns NULL. Replace the
NULL check by a call to IS_ERR().

Signed-off-by: Cyril Roelandt <tipecaml@gmail.com>
---
 drivers/net/ethernet/sfc/ptp.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

David Miller Dec. 12, 2012, 5:15 a.m. UTC | #1
From: Cyril Roelandt <tipecaml@gmail.com>
Date: Wed, 12 Dec 2012 01:24:53 +0100

> The ptp_clock_register() returns ERR_PTR() and never returns NULL. Replace the
> NULL check by a call to IS_ERR().
> 
> Signed-off-by: Cyril Roelandt <tipecaml@gmail.com>

I'll let Ben queue this up.

Probably he'll want to avoid potentially leaving an ERR_PTR
in ptp->phc_clock even if, with this fix, that would be
harmless.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ben Hutchings Dec. 21, 2012, 3:09 a.m. UTC | #2
On Wed, 2012-12-12 at 00:15 -0500, David Miller wrote:
> From: Cyril Roelandt <tipecaml@gmail.com>
> Date: Wed, 12 Dec 2012 01:24:53 +0100
> 
> > The ptp_clock_register() returns ERR_PTR() and never returns NULL. Replace the
> > NULL check by a call to IS_ERR().
> > 
> > Signed-off-by: Cyril Roelandt <tipecaml@gmail.com>
> 
> I'll let Ben queue this up.
> 
> Probably he'll want to avoid potentially leaving an ERR_PTR
> in ptp->phc_clock even if, with this fix, that would be
> harmless.

Sorry for the delay in looking at this.  This change is fine, as the
entire structure *ptp will be freed on the failure path.

I'm now on vacation until the new year.  Cyril, please re-send your
patch with the addition of:

Acked-by: Ben Hutchings <bhutchings@solarflare.com>

so it will show up on 'patchwork' again and David can apply it from
there.

Ben.
diff mbox

Patch

diff --git a/drivers/net/ethernet/sfc/ptp.c b/drivers/net/ethernet/sfc/ptp.c
index 0767043f..9bcc38c 100644
--- a/drivers/net/ethernet/sfc/ptp.c
+++ b/drivers/net/ethernet/sfc/ptp.c
@@ -930,7 +930,7 @@  static int efx_ptp_probe_channel(struct efx_channel *channel)
 
 	ptp->phc_clock = ptp_clock_register(&ptp->phc_clock_info,
 					    &efx->pci_dev->dev);
-	if (!ptp->phc_clock)
+	if (IS_ERR(ptp->phc_clock))
 		goto fail3;
 
 	INIT_WORK(&ptp->pps_work, efx_ptp_pps_worker);