[PATCH 11/25] pcmcia: fix error return code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Julia Lawall <Julia.Lawall@xxxxxxx>

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@xxxxxxx>

---
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 kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux