diff options
author | Julia Lawall <julia@diku.dk> | 2012-08-05 05:52:34 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2012-08-07 02:55:52 -0400 |
commit | d6a2b7ba67334a7e72cd153c142c449831557cb9 (patch) | |
tree | 310699214126954f6e45ef9cb8399e2f7681a2f5 /drivers/gpio | |
parent | f7093f3e7a50bfeeceb8950f9130cbf8af74bf92 (diff) |
drivers/gpio/gpio-langwell.c: fix error return code
Convert a 0 error return code to a negative one, as returned elsewhere in the
function.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
identifier ret;
expression e,e1,e2,e3,e4,x;
@@
(
if (\(ret != 0\|ret < 0\) || ...) { ... return ...; }
|
ret = 0
)
... when != ret = e1
*x = \(kmalloc\|kzalloc\|kcalloc\|devm_kzalloc\|ioremap\|ioremap_nocache\|devm_ioremap\|devm_ioremap_nocache\)(...);
... when != x = e2
when != ret = e3
*if (x == NULL || ...)
{
... when != ret = e4
* return ret;
}
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/gpio-langwell.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/gpio/gpio-langwell.c b/drivers/gpio/gpio-langwell.c index a1c8754f52cf..202a99207b7d 100644 --- a/drivers/gpio/gpio-langwell.c +++ b/drivers/gpio/gpio-langwell.c | |||
@@ -339,7 +339,7 @@ static int __devinit lnw_gpio_probe(struct pci_dev *pdev, | |||
339 | resource_size_t start, len; | 339 | resource_size_t start, len; |
340 | struct lnw_gpio *lnw; | 340 | struct lnw_gpio *lnw; |
341 | u32 gpio_base; | 341 | u32 gpio_base; |
342 | int retval = 0; | 342 | int retval; |
343 | int ngpio = id->driver_data; | 343 | int ngpio = id->driver_data; |
344 | 344 | ||
345 | retval = pci_enable_device(pdev); | 345 | retval = pci_enable_device(pdev); |
@@ -357,6 +357,7 @@ static int __devinit lnw_gpio_probe(struct pci_dev *pdev, | |||
357 | base = ioremap_nocache(start, len); | 357 | base = ioremap_nocache(start, len); |
358 | if (!base) { | 358 | if (!base) { |
359 | dev_err(&pdev->dev, "error mapping bar1\n"); | 359 | dev_err(&pdev->dev, "error mapping bar1\n"); |
360 | retval = -EFAULT; | ||
360 | goto err3; | 361 | goto err3; |
361 | } | 362 | } |
362 | gpio_base = *((u32 *)base + 1); | 363 | gpio_base = *((u32 *)base + 1); |
@@ -381,8 +382,10 @@ static int __devinit lnw_gpio_probe(struct pci_dev *pdev, | |||
381 | 382 | ||
382 | lnw->domain = irq_domain_add_linear(pdev->dev.of_node, ngpio, | 383 | lnw->domain = irq_domain_add_linear(pdev->dev.of_node, ngpio, |
383 | &lnw_gpio_irq_ops, lnw); | 384 | &lnw_gpio_irq_ops, lnw); |
384 | if (!lnw->domain) | 385 | if (!lnw->domain) { |
386 | retval = -ENOMEM; | ||
385 | goto err3; | 387 | goto err3; |
388 | } | ||
386 | 389 | ||
387 | lnw->reg_base = base; | 390 | lnw->reg_base = base; |
388 | lnw->chip.label = dev_name(&pdev->dev); | 391 | lnw->chip.label = dev_name(&pdev->dev); |