[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1388357260-4843-12-git-send-email-Julia.Lawall@lip6.fr>
Date: Sun, 29 Dec 2013 23:47:26 +0100
From: Julia Lawall <Julia.Lawall@...6.fr>
To: linux-pcmcia@...ts.infradead.org
Cc: kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH 11/25] pcmcia: fix error return code
From: Julia Lawall <Julia.Lawall@...6.fr>
Set the return variable to an error code as done elsewhere in the function.
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: Julia Lawall <Julia.Lawall@...6.fr>
---
Not tested.
drivers/pcmcia/electra_cf.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/drivers/pcmcia/electra_cf.c b/drivers/pcmcia/electra_cf.c
index 5ea64d0..b012bd9 100644
--- a/drivers/pcmcia/electra_cf.c
+++ b/drivers/pcmcia/electra_cf.c
@@ -251,23 +251,31 @@ static int electra_cf_probe(struct platform_device *ofdev)
cf->socket.pci_irq = cf->irq;
prop = of_get_property(np, "card-detect-gpio", NULL);
- if (!prop)
+ if (!prop) {
+ status = -ENODEV;
goto fail1;
+ }
cf->gpio_detect = *prop;
prop = of_get_property(np, "card-vsense-gpio", NULL);
- if (!prop)
+ if (!prop) {
+ status = -ENODEV;
goto fail1;
+ }
cf->gpio_vsense = *prop;
prop = of_get_property(np, "card-3v-gpio", NULL);
- if (!prop)
+ if (!prop) {
+ status = -ENODEV;
goto fail1;
+ }
cf->gpio_3v = *prop;
prop = of_get_property(np, "card-5v-gpio", NULL);
- if (!prop)
+ if (!prop) {
+ status = -ENODEV;
goto fail1;
+ }
cf->gpio_5v = *prop;
cf->socket.io_offset = cf->io_base;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists