drivers/net/irda/sh_sir.c: fix error return code
PATCH v2 11/20 drivers/net/irda/sh_sir.c: fix error return code
From: Peter Senna Tschudin <[email protected]>
The function sh_sir_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_mem_*:. 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>
---
Change from V1:
Updated commit message. See:
http://www.kernelhub.org/?p=2&msg9319
drivers/net/irda/sh_sir.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/irda/sh_sir.c +3 -2
@@ -741,6 +741,7 @@ static int __devinit sh_sir_probe(struct platform_device *pdev) self->clk =clk_get (&pdev->dev, clk_name);if (IS_ERR (self->clk)) {dev_err (&pdev->dev,"cannot get clock \"%s\"\n" , clk_name); + err = -ENODEV ; goto err_mem_3; }
@@ -760,8 +761,8 @@ static int __devinit sh_sir_probe(struct platform_device *pdev) goto err_mem_4;platform_set_drvdata (pdev, ndev); - -if (request_irq (irq, sh_sir_irq,IRQF_DISABLED ,"sh_sir" , self)) { + err =request_irq (irq, sh_sir_irq,IRQF_DISABLED ,"sh_sir" , self); +if (err) {dev_warn (&pdev->dev,"Unable to attach sh_sir interrupt\n" ); goto err_mem_4; }
PATCH v2 12/20 drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c: fix error return code
From: Peter Senna Tschudin <[email protected]>
The function qlcnic_probe() return 0 for success and negative value for most of its internal tests failures. There is one exception that is error case going to err_out_free_netdev:. For this error case, the function abort its success execution path, but returns non negative value, making it difficult for a caller function to notice the error.
This patch fixes the error case that do not return negative value.
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>
---
Change from V1:
Updated commit message. See:
http://www.kernelhub.org/?p=2&msg9319
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +2 -1
@@ -1601,7 +1601,8 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) adapter->netdev = netdev; adapter->pdev = pdev; -if (qlcnic_alloc_adapter_resources (adapter)) + err =qlcnic_alloc_adapter_resources (adapter); +if (err) goto err_out_free_netdev; adapter->dev_rst_time = jiffies;
PATCH v2 13/20 drivers/net/ethernet/amd/amd8111e.c: fix error return code
In reply to Peter Senna TschudinFrom: Peter Senna Tschudin <[email protected]>
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>
---
Change from V1:
Updated commit message. See:
http://www.kernelhub.org/?p=2&msg9319
drivers/net/ethernet/amd/amd8111e.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/amd/amd8111e.c +2 -0
@@ -1845,6 +1845,7 @@ static int __devinit amd8111e_probe_one(struct pci_dev *pdev,if ((pm_cap =pci_find_capability (pdev,PCI_CAP_ID_PM ))=0 ){printk (KERN_ERR "amd8111e: No Power Management capability, " "exiting.\n" ); + err = -ENODEV ; goto err_free_reg; }
@@ -1852,6 +1853,7 @@ static int __devinit amd8111e_probe_one(struct pci_dev *pdev,if (pci_set_dma_mask (pdev,DMA_BIT_MASK (32 )) <0 ) {printk (KERN_ERR "amd8111e: DMA not supported," "exiting.\n" ); + err = -ENODEV ; goto err_free_reg; }
PATCH v2 14/20 drivers/net/ethernet/amd/au1000_eth.c: fix error return code
In reply to Peter Senna TschudinFrom: Peter Senna Tschudin <[email protected]>
The function au1000_probe() return 0 for success and negative value for most of its internal tests failures. There are exceptions that are error cases going to err_out:. For this 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>
---
Change from V1:
Updated commit message. See:
http://www.kernelhub.org/?p=2&msg9319
drivers/net/ethernet/amd/au1000_eth.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/net/ethernet/amd/au1000_eth.c +8 -2
@@ -1174,8 +1174,10 @@ static int __devinit au1000_probe(struct platform_device *pdev)snprintf (aup->mii_bus->id,MII_BUS_ID_SIZE ,"%s-%x" , pdev->name, aup->mac_id); aup->mii_bus->irq =kmalloc (sizeof (int )*PHY_MAX_ADDR ,GFP_KERNEL ); -if (aup->mii_bus->irq =NULL ) +if (aup->mii_bus->irq =NULL ) { + err = -ENOMEM ; goto err_out; + }for (i =0 ; i <PHY_MAX_ADDR ; ++i) aup->mii_bus->irq[i] =PHY_POLL ;
@@ -1190,7 +1192,8 @@ static int __devinit au1000_probe(struct platform_device *pdev) goto err_mdiobus_reg; } -if (au1000_mii_probe (dev) !=0 ) + err =au1000_mii_probe (dev); +if (err !=0 ) goto err_out; pDBfree =NULL ;
@@ -1205,6 +1208,7 @@ static int __devinit au1000_probe(struct platform_device *pdev) } aup->pDBfree = pDBfree; + err = -ENODEV ;for (i =0 ; i <NUM_RX_DMA ; i++) { pDB =au1000_GetFreeDB (aup);if (!pDB)
@@ -1213,6 +1217,8 @@ static int __devinit au1000_probe(struct platform_device *pdev) aup->rx_dma_ring[i]->buff_stat = (unsigned )pDB->dma_addr; aup->rx_db_inuse[i] = pDB; } + + err = -ENODEV ;for (i =0 ; i <NUM_TX_DMA ; i++) { pDB =au1000_GetFreeDB (aup);if (!pDB)
PATCH v2 15/20 drivers/net/ethernet/natsemi/xtsonic.c: fix error return code
In reply to Peter Senna TschudinFrom: Peter Senna Tschudin <[email protected]>
The function sonic_probe1() return 0 for success and negative value for most of its internal tests failures. There is one exception that is error case going to out:. For this error case, the function abort its success execution path, but returns non negative value, making it difficult for a caller function to notice the error.
This patch fixes the error case that do not return negative value.
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>
---
Change from V1:
Updated commit message. See:
http://www.kernelhub.org/?p=2&msg9319
drivers/net/ethernet/natsemi/xtsonic.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/natsemi/xtsonic.c +1 -0
@@ -205,6 +205,7 @@ static int __init sonic_probe1(struct net_device *dev)if (lp->descriptors =NULL ) {printk (KERN_ERR "%s: couldn't alloc DMA memory for " " descriptors.\n" ,dev_name (lp->device)); + err = -ENOMEM ; goto out; }
Applied.
Re: [PATCH 12/20 V2] drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c: fix error return code
In reply to Peter Senna TschudinApplied.
Re: [PATCH 13/20 V2] drivers/net/ethernet/amd/amd8111e.c: fix error return code
In reply to Peter Senna TschudinApplied.
Re: [PATCH 14/20 V2] drivers/net/ethernet/amd/au1000_eth.c: fix error return code
In reply to Peter Senna TschudinApplied.
Re: [PATCH 15/20 V2] drivers/net/ethernet/natsemi/xtsonic.c: fix error return code
In reply to Peter Senna TschudinApplied.