Re: [PATCH] mfd: 88pm800: Fix I2C device resource leak if probe fails

From: Lee Jones
Date: Wed Feb 12 2014 - 04:58:48 EST


> During probe the driver allocates two dummy I2C devices for subchips in
> function pm800_pages_init(). Additionally this function allocates
> regmaps for these subchips. If any of these steps fail then these dummy
> I2C devices are not freed and resources leak.
>
> On pm800_pages_init() fail the driver must call pm800_pages_exit() to
> unregister dummy I2C devices.
>
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@xxxxxxxxxxx>
> Cc: stable@xxxxxxxxxxxxxxx
> ---
> drivers/mfd/88pm800.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mfd/88pm800.c b/drivers/mfd/88pm800.c
> index 7dca1e640970..28627c1ff9da 100644
> --- a/drivers/mfd/88pm800.c
> +++ b/drivers/mfd/88pm800.c
> @@ -586,8 +586,8 @@ static int pm800_probe(struct i2c_client *client,
> return 0;
>
> err_device_init:
> - pm800_pages_exit(chip);
> err_page_init:
> + pm800_pages_exit(chip);
> err_subchip_alloc:
> pm80x_deinit();
> out_init:

If you're going to do this, then can you clean-up the superfluous
goto labels please?

--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org â Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
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/