Skip to contentSkip to conversation

pcnet32: remove superfluous NULL pointer check in pcnet32_probe1()

PATCH Applied Bartlomiej Zolnierkiewicz 3 participants 7 messages Jul 30, 2009 – Aug 4, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pcnet32: remove superfluous NULL pointer check in pcnet32_probe1()

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] pcnet32: remove superfluous NULL pointer check in pcnet32_probe1()

Move the debug printk() into the proper place and remove superfluous NULL pointer check in pcnet32_probe1().

This takes care of the following entry from Dan's list:

drivers/net/pcnet32.c +1889 pcnet32_probe1(298) warning: variable derefenced before check 'pdev'

---
 drivers/net/pcnet32.c |   18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)
drivers/net/pcnet32.c +7 -11
Index: b/drivers/net/pcnet32.c
===================================================================
@@ -1611,8 +1611,11 @@ pcnet32_probe1(unsigned long ioaddr, int
 		if (pcnet32_dwio_read_csr(ioaddr, 0) == 4
 		    && pcnet32_dwio_check(ioaddr)) {
 			a = &pcnet32_dwio;
-		} else
+		} else {
+			if (pcnet32_debug & NETIF_MSG_PROBE)
+				printk(KERN_ERR PFX "No access methods\n");
 			goto err_release_region;
+		}
 	}
 
 	chip_version =
@@ -1853,12 +1856,6 @@ pcnet32_probe1(unsigned long ioaddr, int
 	    ((cards_found >= MAX_UNITS) || full_duplex[cards_found]))
 		lp->options |= PCNET32_PORT_FD;
 
-	if (!a) {
-		if (pcnet32_debug & NETIF_MSG_PROBE)
-			printk(KERN_ERR PFX "No access methods\n");
-		ret = -ENODEV;
-		goto err_free_consistent;
-	}
 	lp->a = *a;
 
 	/* prior to register_netdev, dev->name is not yet correct */
@@ -1974,14 +1971,13 @@ pcnet32_probe1(unsigned long ioaddr, int
 
 	return 0;
 
-      err_free_ring:
+err_free_ring:
 	pcnet32_free_ring(dev);
-      err_free_consistent:
 	pci_free_consistent(lp->pci_dev, sizeof(*lp->init_block),
 			    lp->init_block, lp->init_dma_addr);
-      err_free_netdev:
+err_free_netdev:
 	free_netdev(dev);
-      err_release_region:
+err_release_region:
 	release_region(ioaddr, PCNET32_TOTAL_SIZE);
 	return ret;
 }
Acked-by on v1 1/1
#1 lore raw

-----Original Message-----
From: Bartlomiej Zolnierkiewicz <[email protected]>
To: Don Fry <[email protected]>
Cc: [email protected], [email protected], Dan Carpenter <[email protected]>, [email protected], [email protected], Julia Lawall <[email protected]>
Subject: [PATCH] pcnet32: remove superfluous NULL pointer check in pcnet32_probe1()
Date: Thu, 30 Jul 2009 23:19:17 +0200

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] pcnet32: remove superfluous NULL pointer check in pcnet32_probe1()

Move the debug printk() into the proper place and remove superfluous NULL pointer check in pcnet32_probe1().

This takes care of the following entry from Dan's list:

drivers/net/pcnet32.c +1889 pcnet32_probe1(298) warning: variable derefenced before check 'pdev'

---
 drivers/net/pcnet32.c |   18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)
drivers/net/pcnet32.c +7 -11
Index: b/drivers/net/pcnet32.c
===================================================================
@@ -1611,8 +1611,11 @@ pcnet32_probe1(unsigned long ioaddr, int
 		if (pcnet32_dwio_read_csr(ioaddr, 0) == 4
 		    && pcnet32_dwio_check(ioaddr)) {
 			a = &pcnet32_dwio;
-		} else
+		} else {
+			if (pcnet32_debug & NETIF_MSG_PROBE)
+				printk(KERN_ERR PFX "No access methods\n");
 			goto err_release_region;
+		}
 	}
 
 	chip_version =
@@ -1853,12 +1856,6 @@ pcnet32_probe1(unsigned long ioaddr, int
 	    ((cards_found >= MAX_UNITS) || full_duplex[cards_found]))
 		lp->options |= PCNET32_PORT_FD;
 
-	if (!a) {
-		if (pcnet32_debug & NETIF_MSG_PROBE)
-			printk(KERN_ERR PFX "No access methods\n");
-		ret = -ENODEV;
-		goto err_free_consistent;
-	}
 	lp->a = *a;
 
 	/* prior to register_netdev, dev->name is not yet correct */
@@ -1974,14 +1971,13 @@ pcnet32_probe1(unsigned long ioaddr, int
 
 	return 0;
 
-      err_free_ring:
+err_free_ring:
 	pcnet32_free_ring(dev);
-      err_free_consistent:
 	pci_free_consistent(lp->pci_dev, sizeof(*lp->init_block),
 			    lp->init_block, lp->init_dma_addr);
-      err_free_netdev:
+err_free_netdev:
 	free_netdev(dev);
-      err_release_region:
+err_release_region:
 	release_region(ioaddr, PCNET32_TOTAL_SIZE);
 	return ret;
 }

--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer Applied
#2 lore raw
In reply to Bartlomiej Zolnierkiewicz

From: Bartlomiej Zolnierkiewicz <[email protected]>
Date: Thu, 30 Jul 2009 23:19:17 +0200

Quoted 6 lines

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] pcnet32: remove superfluous NULL pointer check in pcnet32_probe1()

Move the debug printk() into the proper place and remove superfluous NULL pointer check in pcnet32_probe1().

Quoted 6 lines

This takes care of the following entry from Dan's list:

drivers/net/pcnet32.c +1889 pcnet32_probe1(298) warning: variable derefenced before check 'pdev'

Applied, but please CC: [email protected] for all future network driver patches so that it gets properly tracked in patchwork. Thanks!

#3 lore raw
Quoted 11 lines · On Sunday 02 August 2009 21:30:22 David Miller wrote:

From: Bartlomiej Zolnierkiewicz <[email protected]>
Date: Thu, 30 Jul 2009 23:19:17 +0200

Quoted 8 lines

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] pcnet32: remove superfluous NULL pointer check in pcnet32_probe1()

Move the debug printk() into the proper place and remove superfluous NULL pointer check in pcnet32_probe1().

This takes care of the following entry from Dan's list:

Quoted 8 lines
Quoted 4 lines

drivers/net/pcnet32.c +1889 pcnet32_probe1(298) warning: variable derefenced before check 'pdev'

Applied, but please CC: [email protected] for all future network driver patches so that it gets properly tracked in patchwork. Thanks!

[email protected] was on cc: for all patches...

http://marc.info/?l=linux-netdev&m=124898901714229&w=2
http://marc.info/?l=linux-netdev&m=124898901714236&w=2

maybe there is some problem with a patchwork setup..

#5 lore raw
Quoted 11 lines · On Sunday 02 August 2009 22:12:56 David Miller wrote:

From: Bartlomiej Zolnierkiewicz <[email protected]>
Date: Sun, 2 Aug 2009 22:07:29 +0200

Quoted 6 lines

[email protected] was on cc: for all patches...

http://marc.info/?l=linux-netdev&m=124898901714229&w=2
http://marc.info/?l=linux-netdev&m=124898901714236&w=2

maybe there is some problem with a patchwork setup..

My bad, I misread the CC: list, sorry.

There still may be some netdev patchwork problem..

These patches were applied with Don as an author:

commit 63097b3ad85788a64c75091bff351ecc850761b2

Author: Don Fry <[email protected]>
Date:   Fri Jul 31 08:45:29 2009 +0000

pcnet32: VLB support fixes

...

commit df4e7f72f5156ef16a918da8a575ba90ec27ab77

Author: Don Fry <[email protected]>
Date:   Fri Jul 31 08:40:06 2009 +0000

pcnet32: remove superfluous NULL pointer check in pcnet32_probe1()

...

maintainer
#6 lore raw

From: Bartlomiej Zolnierkiewicz <[email protected]>
Date: Tue, 4 Aug 2009 12:32:56 +0200

Quoted 9 lines · On Sunday 02 August 2009 22:12:56 David Miller wrote:
Quoted 8 lines

From: Bartlomiej Zolnierkiewicz <[email protected]>
Date: Sun, 2 Aug 2009 22:07:29 +0200

Quoted 5 lines

[email protected] was on cc: for all patches...

http://marc.info/?l=linux-netdev&m=124898901714229&w=2
http://marc.info/?l=linux-netdev&m=124898901714236&w=2

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

maybe there is some problem with a patchwork setup..

My bad, I misread the CC: list, sorry.

There still may be some netdev patchwork problem..

These patches were applied with Don as an author:

It's because he forwarded them to netdev when he ACK'd them, and those are the ones the postings that actually showed up properly in patchwork, and thus the From: lines that got used for authorship.

Sorry, I should have caught that.