* [PATCH 10/20 V2] drivers/net/irda/sh_irda.c: fix error return code
@ 2012-10-05 21:33 Peter Senna Tschudin
2012-10-05 21:33 ` [PATCH 6/20 V2] drivers/net/irda/irtty-sir.c: " Peter Senna Tschudin
` (4 more replies)
0 siblings, 5 replies; 10+ messages in thread
From: Peter Senna Tschudin @ 2012-10-05 21:33 UTC (permalink / raw)
To: samuel
Cc: irda-users, netdev, linux-kernel, kernel-janitors,
Peter Senna Tschudin
From: Peter Senna Tschudin <peter.senna@gmail.com>
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>
Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
---
Change from V1:
Updated commit message. See:
http://www.kernelhub.org/?p=2&msg=139319
drivers/net/irda/sh_irda.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/irda/sh_irda.c b/drivers/net/irda/sh_irda.c
index eb315b8..4b746d9 100644
--- a/drivers/net/irda/sh_irda.c
+++ b/drivers/net/irda/sh_irda.c
@@ -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;
}
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 6/20 V2] drivers/net/irda/irtty-sir.c: fix error return code
2012-10-05 21:33 [PATCH 10/20 V2] drivers/net/irda/sh_irda.c: fix error return code Peter Senna Tschudin
@ 2012-10-05 21:33 ` Peter Senna Tschudin
2012-10-07 18:38 ` David Miller
2012-10-05 21:33 ` [PATCH 7/20 V2] drivers/net/irda/mcs7780.c: " Peter Senna Tschudin
` (3 subsequent siblings)
4 siblings, 1 reply; 10+ messages in thread
From: Peter Senna Tschudin @ 2012-10-05 21:33 UTC (permalink / raw)
To: samuel
Cc: irda-users, netdev, linux-kernel, kernel-janitors,
Peter Senna Tschudin
From: Peter Senna Tschudin <peter.senna@gmail.com>
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>
Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
---
Change from V1:
Updated commit message. See:
http://www.kernelhub.org/?p=2&msg=139319
drivers/net/irda/irtty-sir.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/irda/irtty-sir.c b/drivers/net/irda/irtty-sir.c
index 30087ca..6e4d4b6 100644
--- a/drivers/net/irda/irtty-sir.c
+++ b/drivers/net/irda/irtty-sir.c
@@ -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;
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 7/20 V2] drivers/net/irda/mcs7780.c: fix error return code
2012-10-05 21:33 [PATCH 10/20 V2] drivers/net/irda/sh_irda.c: fix error return code Peter Senna Tschudin
2012-10-05 21:33 ` [PATCH 6/20 V2] drivers/net/irda/irtty-sir.c: " Peter Senna Tschudin
@ 2012-10-05 21:33 ` Peter Senna Tschudin
2012-10-07 18:38 ` David Miller
2012-10-05 21:33 ` [PATCH 8/20 V2] drivers/net/irda/pxaficp_ir.c: " Peter Senna Tschudin
` (2 subsequent siblings)
4 siblings, 1 reply; 10+ messages in thread
From: Peter Senna Tschudin @ 2012-10-05 21:33 UTC (permalink / raw)
To: samuel
Cc: irda-users, netdev, linux-kernel, kernel-janitors,
Peter Senna Tschudin
From: Peter Senna Tschudin <peter.senna@gmail.com>
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>
Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
---
Change from V1:
Updated commit message. See:
http://www.kernelhub.org/?p=2&msg=139319
drivers/net/irda/mcs7780.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/irda/mcs7780.c b/drivers/net/irda/mcs7780.c
index 1a00b59..f07c340 100644
--- a/drivers/net/irda/mcs7780.c
+++ b/drivers/net/irda/mcs7780.c
@@ -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);
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 8/20 V2] drivers/net/irda/pxaficp_ir.c: fix error return code
2012-10-05 21:33 [PATCH 10/20 V2] drivers/net/irda/sh_irda.c: fix error return code Peter Senna Tschudin
2012-10-05 21:33 ` [PATCH 6/20 V2] drivers/net/irda/irtty-sir.c: " Peter Senna Tschudin
2012-10-05 21:33 ` [PATCH 7/20 V2] drivers/net/irda/mcs7780.c: " Peter Senna Tschudin
@ 2012-10-05 21:33 ` Peter Senna Tschudin
[not found] ` <1349472786-10921-4-git-send-email-peter.senna-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-10-05 21:33 ` [PATCH 9/20 V2] drivers/net/irda/sa1100_ir.c: " Peter Senna Tschudin
[not found] ` <1349472786-10921-1-git-send-email-peter.senna-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
4 siblings, 1 reply; 10+ messages in thread
From: Peter Senna Tschudin @ 2012-10-05 21:33 UTC (permalink / raw)
To: samuel
Cc: irda-users, netdev, linux-kernel, kernel-janitors,
Peter Senna Tschudin
From: Peter Senna Tschudin <peter.senna@gmail.com>
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>
Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
---
Change from V1:
Updated commit message. See:
http://www.kernelhub.org/?p=2&msg=139319
drivers/net/irda/pxaficp_ir.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/irda/pxaficp_ir.c b/drivers/net/irda/pxaficp_ir.c
index 002a442..858de05 100644
--- a/drivers/net/irda/pxaficp_ir.c
+++ b/drivers/net/irda/pxaficp_ir.c
@@ -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);
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 9/20 V2] drivers/net/irda/sa1100_ir.c: fix error return code
2012-10-05 21:33 [PATCH 10/20 V2] drivers/net/irda/sh_irda.c: fix error return code Peter Senna Tschudin
` (2 preceding siblings ...)
2012-10-05 21:33 ` [PATCH 8/20 V2] drivers/net/irda/pxaficp_ir.c: " Peter Senna Tschudin
@ 2012-10-05 21:33 ` Peter Senna Tschudin
[not found] ` <1349472786-10921-5-git-send-email-peter.senna-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
[not found] ` <1349472786-10921-1-git-send-email-peter.senna-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
4 siblings, 1 reply; 10+ messages in thread
From: Peter Senna Tschudin @ 2012-10-05 21:33 UTC (permalink / raw)
To: samuel
Cc: irda-users, netdev, linux-kernel, kernel-janitors,
Peter Senna Tschudin
From: Peter Senna Tschudin <peter.senna@gmail.com>
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>
Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
---
Change from V1:
Updated commit message. See:
http://www.kernelhub.org/?p=2&msg=139319
drivers/net/irda/sa1100_ir.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/irda/sa1100_ir.c b/drivers/net/irda/sa1100_ir.c
index e250675..42fde9e 100644
--- a/drivers/net/irda/sa1100_ir.c
+++ b/drivers/net/irda/sa1100_ir.c
@@ -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);
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 6/20 V2] drivers/net/irda/irtty-sir.c: fix error return code
2012-10-05 21:33 ` [PATCH 6/20 V2] drivers/net/irda/irtty-sir.c: " Peter Senna Tschudin
@ 2012-10-07 18:38 ` David Miller
0 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2012-10-07 18:38 UTC (permalink / raw)
To: peter.senna; +Cc: samuel, irda-users, netdev, linux-kernel, kernel-janitors
Applied.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 7/20 V2] drivers/net/irda/mcs7780.c: fix error return code
2012-10-05 21:33 ` [PATCH 7/20 V2] drivers/net/irda/mcs7780.c: " Peter Senna Tschudin
@ 2012-10-07 18:38 ` David Miller
0 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2012-10-07 18:38 UTC (permalink / raw)
To: peter.senna; +Cc: samuel, irda-users, netdev, linux-kernel, kernel-janitors
Applied.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 8/20 V2] drivers/net/irda/pxaficp_ir.c: fix error return code
[not found] ` <1349472786-10921-4-git-send-email-peter.senna-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2012-10-07 18:38 ` David Miller
0 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2012-10-07 18:38 UTC (permalink / raw)
To: peter.senna-Re5JQEeQqe8AvxtiuMwx3w
Cc: irda-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
samuel-jcdQHdrhKHMdnm+yROfE0A,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
netdev-u79uwXL29TY76Z2rM5mHXA
Applied.
------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 9/20 V2] drivers/net/irda/sa1100_ir.c: fix error return code
[not found] ` <1349472786-10921-5-git-send-email-peter.senna-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2012-10-07 18:38 ` David Miller
0 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2012-10-07 18:38 UTC (permalink / raw)
To: peter.senna-Re5JQEeQqe8AvxtiuMwx3w
Cc: irda-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
samuel-jcdQHdrhKHMdnm+yROfE0A,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
netdev-u79uwXL29TY76Z2rM5mHXA
Applied.
------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 10/20 V2] drivers/net/irda/sh_irda.c: fix error return code
[not found] ` <1349472786-10921-1-git-send-email-peter.senna-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2012-10-07 18:38 ` David Miller
0 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2012-10-07 18:38 UTC (permalink / raw)
To: peter.senna-Re5JQEeQqe8AvxtiuMwx3w
Cc: irda-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
samuel-jcdQHdrhKHMdnm+yROfE0A,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
netdev-u79uwXL29TY76Z2rM5mHXA
Applied.
------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2012-10-07 18:38 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-05 21:33 [PATCH 10/20 V2] drivers/net/irda/sh_irda.c: fix error return code Peter Senna Tschudin
2012-10-05 21:33 ` [PATCH 6/20 V2] drivers/net/irda/irtty-sir.c: " Peter Senna Tschudin
2012-10-07 18:38 ` David Miller
2012-10-05 21:33 ` [PATCH 7/20 V2] drivers/net/irda/mcs7780.c: " Peter Senna Tschudin
2012-10-07 18:38 ` David Miller
2012-10-05 21:33 ` [PATCH 8/20 V2] drivers/net/irda/pxaficp_ir.c: " Peter Senna Tschudin
[not found] ` <1349472786-10921-4-git-send-email-peter.senna-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-10-07 18:38 ` David Miller
2012-10-05 21:33 ` [PATCH 9/20 V2] drivers/net/irda/sa1100_ir.c: " Peter Senna Tschudin
[not found] ` <1349472786-10921-5-git-send-email-peter.senna-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-10-07 18:38 ` David Miller
[not found] ` <1349472786-10921-1-git-send-email-peter.senna-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-10-07 18:38 ` [PATCH 10/20 V2] drivers/net/irda/sh_irda.c: " David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).