Re: [PATCH 1/2] [ARM] am200epd: fix resource leak inam200_init_gpio_regs error path

From: Eric Miao
Date: Thu Mar 17 2011 - 11:07:30 EST


Applied.

On Mon, Mar 7, 2011 at 1:55 PM, Axel Lin <axel.lin@xxxxxxxxx> wrote:
> If gpio_request fails when i > 0, gpios[0] is not freed in current
> implementation.
>
> Signed-off-by: Axel Lin <axel.lin@xxxxxxxxx>
> ---
> Âarch/arm/mach-pxa/am200epd.c | Â Â4 ++--
> Â1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-pxa/am200epd.c b/arch/arm/mach-pxa/am200epd.c
> index 3499fad..811d797 100644
> --- a/arch/arm/mach-pxa/am200epd.c
> +++ b/arch/arm/mach-pxa/am200epd.c
> @@ -128,8 +128,8 @@ static int am200_init_gpio_regs(struct metronomefb_par *par)
> Â Â Â Âreturn 0;
>
> Âerr_req_gpio:
> - Â Â Â while (i > 0)
> - Â Â Â Â Â Â Â gpio_free(gpios[i--]);
> + Â Â Â while (--i >= 0)
> + Â Â Â Â Â Â Â gpio_free(gpios[i]);
>
> Â Â Â Âreturn err;
> Â}
> --
> 1.7.2
>
>
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/