Skip to content

Commit

Permalink
x86 platform drivers: fix gpio leak
Browse files Browse the repository at this point in the history
when request_irq fails, we should release gpiochip

v2:
  fix warning: ignoring return value of 'gpiochip_remove

Signed-off-by: Libo Chen <libo.chen@huawei.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
  • Loading branch information
Libo Chen authored and Matthew Garrett committed Jul 10, 2013
1 parent 283672e commit fef8ce1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/platform/x86/intel_pmic_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ static int platform_pmic_gpio_probe(struct platform_device *pdev)
retval = request_irq(pg->irq, pmic_irq_handler, 0, "pmic", pg);
if (retval) {
pr_warn("Interrupt request failed\n");
goto err;
goto fail_request_irq;
}

for (i = 0; i < 8; i++) {
Expand All @@ -299,6 +299,10 @@ static int platform_pmic_gpio_probe(struct platform_device *pdev)
irq_set_chip_data(i + pg->irq_base, pg);
}
return 0;

fail_request_irq:
if (gpiochip_remove(&pg->chip))
pr_err("gpiochip_remove failed\n");
err:
iounmap(pg->gpiointr);
err2:
Expand Down

0 comments on commit fef8ce1

Please sign in to comment.