drivers/net/irda/sh_irda.c: fix error return code
Subsystems (3)
PATCH v2 10/20 drivers/net/irda/sh_irda.c: fix error return code
From: Peter Senna Tschudin <[email protected]>
The function sh_irda_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_mem_4:. 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/irda/sh_irda.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/irda/sh_irda.c +2 -2
@@ -808,8 +808,8 @@ static int __devinit sh_irda_probe(struct platform_device *pdev) goto err_mem_4;platform_set_drvdata (pdev, ndev); - -if (request_irq (irq, sh_irda_irq,IRQF_DISABLED ,"sh_irda" , self)) { + err =request_irq (irq, sh_irda_irq,IRQF_DISABLED ,"sh_irda" , self); +if (err) {dev_warn (&pdev->dev,"Unable to attach sh_irda interrupt\n" ); goto err_mem_4; }
PATCH v2 6/20 drivers/net/irda/irtty-sir.c: fix error return code
From: Peter Senna Tschudin <[email protected]>
The function irtty_open() 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_put:. 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/irda/irtty-sir.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/irda/irtty-sir.c +3 -1
@@ -459,8 +459,10 @@ static int irtty_open(struct tty_struct *tty)/* allocate private device info block */ priv =kzalloc (sizeof (*priv),GFP_KERNEL ); -if (!priv) +if (!priv) { + ret = -ENOMEM ; goto out_put; + } priv->magic =IRTTY_MAGIC ; priv->tty = tty;
Re: [PATCH 6/20 V2] drivers/net/irda/irtty-sir.c: fix error return code
Applied.
PATCH v2 7/20 drivers/net/irda/mcs7780.c: fix error return code
In reply to Peter Senna TschudinFrom: Peter Senna Tschudin <[email protected]>
The function mcs_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 error2:. 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.
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/mcs7780.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/irda/mcs7780.c +3 -1
@@ -920,8 +920,10 @@ static int mcs_probe(struct usb_interface *intf, ndev->netdev_ops = &mcs_netdev_ops; -if (!intf->cur_altsetting) +if (!intf->cur_altsetting) { + ret = -ENOMEM ; goto error2; + } ret =mcs_find_endpoints (mcs, intf->cur_altsetting->endpoint, intf->cur_altsetting->desc.bNumEndpoints);
Re: [PATCH 7/20 V2] drivers/net/irda/mcs7780.c: fix error return code
Applied.
PATCH v2 8/20 drivers/net/irda/pxaficp_ir.c: fix error return code
In reply to Peter Senna TschudinFrom: Peter Senna Tschudin <[email protected]>
The function pxa_irda_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_mem_3:. 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/irda/pxaficp_ir.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/irda/pxaficp_ir.c +3 -1
@@ -846,8 +846,10 @@ static int pxa_irda_probe(struct platform_device *pdev) goto err_mem_2; dev =alloc_irdadev (sizeof (struct pxa_irda )); -if (!dev) +if (!dev) { + err = -ENOMEM ; goto err_mem_3; + }SET_NETDEV_DEV (dev, &pdev->dev); si =netdev_priv (dev);
Re: [PATCH 8/20 V2] drivers/net/irda/pxaficp_ir.c: fix error return code
Applied.
PATCH v2 9/20 drivers/net/irda/sa1100_ir.c: fix error return code
In reply to Peter Senna TschudinFrom: Peter Senna Tschudin <[email protected]>
The function sa1100_irda_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_mem_4:. 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/irda/sa1100_ir.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/irda/sa1100_ir.c +3 -1
@@ -940,8 +940,10 @@ static int sa1100_irda_probe(struct platform_device *pdev) goto err_mem_3; dev =alloc_irdadev (sizeof (struct sa1100_irda )); -if (!dev) +if (!dev) { + err = -ENOMEM ; goto err_mem_4; + }SET_NETDEV_DEV (dev, &pdev->dev);
Re: [PATCH 9/20 V2] drivers/net/irda/sa1100_ir.c: fix error return code
Applied.
Applied.