Commit cfb10898 authored by Axel Lin's avatar Axel Lin Committed by Linus Walleij

gpio: Don't override the error code in probe error handling

Otherwise, we return 0 in probe error paths when gpiochip_remove() returns 0.
Also show error message if gpiochip_remove() fails.
Signed-off-by: default avatarAxel Lin <axel.lin@ingics.com>
Cc: Tomoya MORINAGA <tomoya.rohm@gmail.com>
Cc: Denis Turischev <denis@compulab.co.il>
Cc: Lars Poeschel <poeschel@lemonage.de>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 90dae4eb
...@@ -496,8 +496,7 @@ static int ioh_gpio_probe(struct pci_dev *pdev, ...@@ -496,8 +496,7 @@ static int ioh_gpio_probe(struct pci_dev *pdev,
err_gpiochip_add: err_gpiochip_add:
while (--i >= 0) { while (--i >= 0) {
chip--; chip--;
ret = gpiochip_remove(&chip->gpio); if (gpiochip_remove(&chip->gpio))
if (ret)
dev_err(&pdev->dev, "Failed gpiochip_remove(%d)\n", i); dev_err(&pdev->dev, "Failed gpiochip_remove(%d)\n", i);
} }
kfree(chip_save); kfree(chip_save);
......
...@@ -424,8 +424,7 @@ static int pch_gpio_probe(struct pci_dev *pdev, ...@@ -424,8 +424,7 @@ static int pch_gpio_probe(struct pci_dev *pdev,
err_request_irq: err_request_irq:
irq_free_descs(irq_base, gpio_pins[chip->ioh]); irq_free_descs(irq_base, gpio_pins[chip->ioh]);
ret = gpiochip_remove(&chip->gpio); if (gpiochip_remove(&chip->gpio))
if (ret)
dev_err(&pdev->dev, "%s gpiochip_remove failed\n", __func__); dev_err(&pdev->dev, "%s gpiochip_remove failed\n", __func__);
err_gpiochip_add: err_gpiochip_add:
......
...@@ -272,10 +272,8 @@ static int sch_gpio_probe(struct platform_device *pdev) ...@@ -272,10 +272,8 @@ static int sch_gpio_probe(struct platform_device *pdev)
return 0; return 0;
err_sch_gpio_resume: err_sch_gpio_resume:
err = gpiochip_remove(&sch_gpio_core); if (gpiochip_remove(&sch_gpio_core))
if (err) dev_err(&pdev->dev, "%s gpiochip_remove failed\n", __func__);
dev_err(&pdev->dev, "%s failed, %d\n",
"gpiochip_remove()", err);
err_sch_gpio_core: err_sch_gpio_core:
release_region(res->start, resource_size(res)); release_region(res->start, resource_size(res));
......
...@@ -446,7 +446,8 @@ static int vprbrd_gpio_probe(struct platform_device *pdev) ...@@ -446,7 +446,8 @@ static int vprbrd_gpio_probe(struct platform_device *pdev)
return ret; return ret;
err_gpiob: err_gpiob:
ret = gpiochip_remove(&vb_gpio->gpioa); if (gpiochip_remove(&vb_gpio->gpioa))
dev_err(&pdev->dev, "%s gpiochip_remove failed\n", __func__);
err_gpioa: err_gpioa:
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment