Commit df4e7f72 authored by Don Fry's avatar Don Fry Committed by David S. Miller

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'
Reported-by: default avatarDan Carpenter <error27@gmail.com>
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Acked-by: default avatarDon Fry <pcnet32@verizon.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a6ac65db
...@@ -1611,9 +1611,12 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) ...@@ -1611,9 +1611,12 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev)
if (pcnet32_dwio_read_csr(ioaddr, 0) == 4 if (pcnet32_dwio_read_csr(ioaddr, 0) == 4
&& pcnet32_dwio_check(ioaddr)) { && pcnet32_dwio_check(ioaddr)) {
a = &pcnet32_dwio; a = &pcnet32_dwio;
} else } else {
if (pcnet32_debug & NETIF_MSG_PROBE)
printk(KERN_ERR PFX "No access methods\n");
goto err_release_region; goto err_release_region;
} }
}
chip_version = chip_version =
a->read_csr(ioaddr, 88) | (a->read_csr(ioaddr, 89) << 16); a->read_csr(ioaddr, 88) | (a->read_csr(ioaddr, 89) << 16);
...@@ -1852,12 +1855,6 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) ...@@ -1852,12 +1855,6 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev)
((cards_found >= MAX_UNITS) || full_duplex[cards_found])) ((cards_found >= MAX_UNITS) || full_duplex[cards_found]))
lp->options |= PCNET32_PORT_FD; 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; lp->a = *a;
/* prior to register_netdev, dev->name is not yet correct */ /* prior to register_netdev, dev->name is not yet correct */
...@@ -1973,14 +1970,13 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) ...@@ -1973,14 +1970,13 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev)
return 0; return 0;
err_free_ring: err_free_ring:
pcnet32_free_ring(dev); pcnet32_free_ring(dev);
err_free_consistent:
pci_free_consistent(lp->pci_dev, sizeof(*lp->init_block), pci_free_consistent(lp->pci_dev, sizeof(*lp->init_block),
lp->init_block, lp->init_dma_addr); lp->init_block, lp->init_dma_addr);
err_free_netdev: err_free_netdev:
free_netdev(dev); free_netdev(dev);
err_release_region: err_release_region:
release_region(ioaddr, PCNET32_TOTAL_SIZE); release_region(ioaddr, PCNET32_TOTAL_SIZE);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment