aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Senna Tschudin <peter.senna@gmail.com>2012-10-05 08:40:56 -0400
committerDavid S. Miller <davem@davemloft.net>2012-10-07 14:37:12 -0400
commit0bd8ba18b9384e1c9104eee1d912fd5c8b4234c0 (patch)
tree647b62cc8f0029e128f213285fe2832372981d6d
parentbbcf61fb30279c99e51b9d20b231e8513c5e6b1d (diff)
drivers/net/ethernet/marvell/sky2.c: fix error return code
The function sky2_probe() 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_out*:. 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>
-rw-r--r--drivers/net/ethernet/marvell/sky2.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c
index 2b0748dba8b..78946feab4a 100644
--- a/drivers/net/ethernet/marvell/sky2.c
+++ b/drivers/net/ethernet/marvell/sky2.c
@@ -4924,6 +4924,7 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
4924 4924
4925 if (~reg == 0) { 4925 if (~reg == 0) {
4926 dev_err(&pdev->dev, "PCI configuration read error\n"); 4926 dev_err(&pdev->dev, "PCI configuration read error\n");
4927 err = -EIO;
4927 goto err_out; 4928 goto err_out;
4928 } 4929 }
4929 4930
@@ -4993,8 +4994,10 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
4993 hw->st_size = hw->ports * roundup_pow_of_two(3*RX_MAX_PENDING + TX_MAX_PENDING); 4994 hw->st_size = hw->ports * roundup_pow_of_two(3*RX_MAX_PENDING + TX_MAX_PENDING);
4994 hw->st_le = pci_alloc_consistent(pdev, hw->st_size * sizeof(struct sky2_status_le), 4995 hw->st_le = pci_alloc_consistent(pdev, hw->st_size * sizeof(struct sky2_status_le),
4995 &hw->st_dma); 4996 &hw->st_dma);
4996 if (!hw->st_le) 4997 if (!hw->st_le) {
4998 err = -ENOMEM;
4997 goto err_out_reset; 4999 goto err_out_reset;
5000 }
4998 5001
4999 dev_info(&pdev->dev, "Yukon-2 %s chip revision %d\n", 5002 dev_info(&pdev->dev, "Yukon-2 %s chip revision %d\n",
5000 sky2_name(hw->chip_id, buf1, sizeof(buf1)), hw->chip_rev); 5003 sky2_name(hw->chip_id, buf1, sizeof(buf1)), hw->chip_rev);