From fef8ce166b2d5cdba8bbf85fa48c4cb8d75ffec4 Mon Sep 17 00:00:00 2001 From: Libo Chen Date: Tue, 9 Jul 2013 20:34:28 +0800 Subject: x86 platform drivers: fix gpio leak when request_irq fails, we should release gpiochip v2: fix warning: ignoring return value of 'gpiochip_remove Signed-off-by: Libo Chen Signed-off-by: Matthew Garrett --- drivers/platform/x86/intel_pmic_gpio.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'drivers/platform') diff --git a/drivers/platform/x86/intel_pmic_gpio.c b/drivers/platform/x86/intel_pmic_gpio.c index 6f4b7289a059..2805988485f6 100644 --- a/drivers/platform/x86/intel_pmic_gpio.c +++ b/drivers/platform/x86/intel_pmic_gpio.c @@ -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++) { @@ -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: -- cgit v1.2.1