diff options
author | Axel Lin <axel.lin@gmail.com> | 2011-03-07 13:56:11 +0800 |
---|---|---|
committer | Eric Miao <eric.y.miao@gmail.com> | 2011-03-17 23:06:29 +0800 |
commit | 5898eb79fb45d4fd4ce22139c168de937bfaab38 (patch) | |
tree | 2ee16f59af3868349c3e35a47f7035ef481c6a8c /arch/arm/mach-pxa | |
parent | 8aad172e6c54c74b1effe88ded2f308db3e1b658 (diff) |
ARM: pxa/am300epd: fix leak in am300_init_gpio_regs error path
If gpio_request fails when i > 0, gpios[0] is not freed in current
implementation.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
Diffstat (limited to 'arch/arm/mach-pxa')
-rw-r--r-- | arch/arm/mach-pxa/am300epd.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/arch/arm/mach-pxa/am300epd.c b/arch/arm/mach-pxa/am300epd.c index 993d75e66390..fa8bad235d9f 100644 --- a/arch/arm/mach-pxa/am300epd.c +++ b/arch/arm/mach-pxa/am300epd.c @@ -125,10 +125,7 @@ static int am300_init_gpio_regs(struct broadsheetfb_par *par) if (err) { dev_err(&am300_device->dev, "failed requesting " "gpio %d, err=%d\n", i, err); - while (i >= DB0_GPIO_PIN) - gpio_free(i--); - i = ARRAY_SIZE(gpios) - 1; - goto err_req_gpio; + goto err_req_gpio2; } } @@ -159,9 +156,13 @@ static int am300_init_gpio_regs(struct broadsheetfb_par *par) return 0; +err_req_gpio2: + while (--i >= DB0_GPIO_PIN) + gpio_free(i); + i = ARRAY_SIZE(gpios); err_req_gpio: - while (i > 0) - gpio_free(gpios[i--]); + while (--i >= 0) + gpio_free(gpios[i]); return err; } |