aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorPeter Senna Tschudin <peter.senna@gmail.com>2012-10-05 08:10:51 -0400
committerDavid S. Miller <davem@davemloft.net>2012-10-07 14:37:11 -0400
commit86e506e39909d356ca1c76c00022f3c64f5b7665 (patch)
treeedb296acafa7d5121a9eea35ed15ab292662464c /drivers/net
parent2dfc96719187d3cb632922a9455abd008db467eb (diff)
drivers/net/ethernet/amd/amd8111e.c: fix error return code
The function amd8111e_probe_one() return 0 for success and negative value for most of its internal tests failures. There are two exceptions that are error cases going to err_free_reg:. For this two cases, the function abort its success execution path, but returns non negative value, making it dificult for a caller function to notice the error. This patch fixes the error cases that do not return negative values. This was found by Coccinelle, but the code change was made by hand. This patch is not robot generated. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // <smpl> ( if@p1 (\(ret < 0\|ret != 0\)) { ... return ret; } | ret@p1 = 0 ) ... when != ret = e1 when != &ret *if(...) { ... when != ret = e2 when forall return ret; } // </smpl> Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/amd/amd8111e.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/net/ethernet/amd/amd8111e.c b/drivers/net/ethernet/amd/amd8111e.c
index 64d0d9c1afa2..3491d4312fc9 100644
--- a/drivers/net/ethernet/amd/amd8111e.c
+++ b/drivers/net/ethernet/amd/amd8111e.c
@@ -1845,6 +1845,7 @@ static int __devinit amd8111e_probe_one(struct pci_dev *pdev,
1845 if((pm_cap = pci_find_capability(pdev, PCI_CAP_ID_PM))==0){ 1845 if((pm_cap = pci_find_capability(pdev, PCI_CAP_ID_PM))==0){
1846 printk(KERN_ERR "amd8111e: No Power Management capability, " 1846 printk(KERN_ERR "amd8111e: No Power Management capability, "
1847 "exiting.\n"); 1847 "exiting.\n");
1848 err = -ENODEV;
1848 goto err_free_reg; 1849 goto err_free_reg;
1849 } 1850 }
1850 1851
@@ -1852,6 +1853,7 @@ static int __devinit amd8111e_probe_one(struct pci_dev *pdev,
1852 if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) < 0) { 1853 if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) < 0) {
1853 printk(KERN_ERR "amd8111e: DMA not supported," 1854 printk(KERN_ERR "amd8111e: DMA not supported,"
1854 "exiting.\n"); 1855 "exiting.\n");
1856 err = -ENODEV;
1855 goto err_free_reg; 1857 goto err_free_reg;
1856 } 1858 }
1857 1859