diff mbox

net: tulip: delete useless tests on netdev_priv

Message ID 1388680129-13661-1-git-send-email-Julia.Lawall@lip6.fr
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Julia Lawall Jan. 2, 2014, 4:28 p.m. UTC
From: Julia Lawall <Julia.Lawall@lip6.fr>

Netdev_priv performs an addition, not a pointer dereference, so it seems
quit unlikely that its result would ever be NULL.

A semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
statement S;
@@

- if (!netdev_priv(...)) S
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/net/ethernet/dec/tulip/uli526x.c |    6 ------
 1 file changed, 6 deletions(-)


--
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

Comments

Grant Grundler Jan. 2, 2014, 3:57 p.m. UTC | #1
On Thu, Jan 2, 2014 at 8:28 AM, Julia Lawall <Julia.Lawall@lip6.fr> wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
> Netdev_priv performs an addition, not a pointer dereference, so it seems
> quit unlikely that its result would ever be NULL.

LGTM.

 >
> A semantic patch that makes this change is as follows:
> (http://coccinelle.lip6.fr/)
>
> // <smpl>
> @@
> statement S;
> @@
>
> - if (!netdev_priv(...)) S
> // </smpl>
>
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

Acked-by: Grant Grundler <grundler@parisc-linux.org>

cheers,
grant

>
> ---
>  drivers/net/ethernet/dec/tulip/uli526x.c |    6 ------
>  1 file changed, 6 deletions(-)
>
> diff --git a/drivers/net/ethernet/dec/tulip/uli526x.c b/drivers/net/ethernet/dec/tulip/uli526x.c
> index a5397b1..aa4ee38 100644
> --- a/drivers/net/ethernet/dec/tulip/uli526x.c
> +++ b/drivers/net/ethernet/dec/tulip/uli526x.c
> @@ -1192,9 +1192,6 @@ static int uli526x_suspend(struct pci_dev *pdev, pm_message_t state)
>
>         ULI526X_DBUG(0, "uli526x_suspend", 0);
>
> -       if (!netdev_priv(dev))
> -               return 0;
> -
>         pci_save_state(pdev);
>
>         if (!netif_running(dev))
> @@ -1228,9 +1225,6 @@ static int uli526x_resume(struct pci_dev *pdev)
>
>         ULI526X_DBUG(0, "uli526x_resume", 0);
>
> -       if (!netdev_priv(dev))
> -               return 0;
> -
>         pci_restore_state(pdev);
>
>         if (!netif_running(dev))
>
--
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
David Miller Jan. 4, 2014, 12:35 a.m. UTC | #2
From: Grant Grundler <grantgrundler@gmail.com>
Date: Thu, 2 Jan 2014 07:57:26 -0800

> On Thu, Jan 2, 2014 at 8:28 AM, Julia Lawall <Julia.Lawall@lip6.fr> wrote:
>> From: Julia Lawall <Julia.Lawall@lip6.fr>
>>
>> Netdev_priv performs an addition, not a pointer dereference, so it seems
>> quit unlikely that its result would ever be NULL.
> 
> LGTM.
> 
>  >
>> A semantic patch that makes this change is as follows:
>> (http://coccinelle.lip6.fr/)
>>
>> // <smpl>
>> @@
>> statement S;
>> @@
>>
>> - if (!netdev_priv(...)) S
>> // </smpl>
>>
>> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> Acked-by: Grant Grundler <grundler@parisc-linux.org>

Applied, thanks everyone.
--
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
diff mbox

Patch

diff --git a/drivers/net/ethernet/dec/tulip/uli526x.c b/drivers/net/ethernet/dec/tulip/uli526x.c
index a5397b1..aa4ee38 100644
--- a/drivers/net/ethernet/dec/tulip/uli526x.c
+++ b/drivers/net/ethernet/dec/tulip/uli526x.c
@@ -1192,9 +1192,6 @@  static int uli526x_suspend(struct pci_dev *pdev, pm_message_t state)
 
 	ULI526X_DBUG(0, "uli526x_suspend", 0);
 
-	if (!netdev_priv(dev))
-		return 0;
-
 	pci_save_state(pdev);
 
 	if (!netif_running(dev))
@@ -1228,9 +1225,6 @@  static int uli526x_resume(struct pci_dev *pdev)
 
 	ULI526X_DBUG(0, "uli526x_resume", 0);
 
-	if (!netdev_priv(dev))
-		return 0;
-
 	pci_restore_state(pdev);
 
 	if (!netif_running(dev))