Re: [PATCH v2 1/3] staging: typec: fusb302: do not free gpio from managed resource

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks! Nice catch.

On Fri, May 12, 2017 at 2:38 AM, Rui Miguel Silva <rmfrfs@xxxxxxxxx> wrote:
> When allocating a gpio using the managed resource devm_, we can avoid freeing it
> manually. But even if we did it we should use devm_gpio_free.
>
> So, just remove the free of the gpio in the error path.
>
> Signed-off-by: Rui Miguel Silva <rmfrfs@xxxxxxxxx>
Acked-by: Yueyao Zhu <yueyao.zhu@xxxxxxxxx>
> ---
>  drivers/staging/typec/fusb302/fusb302.c | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/drivers/staging/typec/fusb302/fusb302.c b/drivers/staging/typec/fusb302/fusb302.c
> index 2cee9a952c9b..65df6407db84 100644
> --- a/drivers/staging/typec/fusb302/fusb302.c
> +++ b/drivers/staging/typec/fusb302/fusb302.c
> @@ -1663,14 +1663,12 @@ static int init_gpio(struct fusb302_chip *chip)
>         if (ret < 0) {
>                 fusb302_log(chip,
>                             "cannot set GPIO Int_N to input, ret=%d", ret);
> -               gpio_free(chip->gpio_int_n);
>                 return ret;
>         }
>         ret = gpio_to_irq(chip->gpio_int_n);
>         if (ret < 0) {
>                 fusb302_log(chip,
>                             "cannot request IRQ for GPIO Int_N, ret=%d", ret);
> -               gpio_free(chip->gpio_int_n);
>                 return ret;
>         }
>         chip->gpio_int_n_irq = ret;
> --
> 2.12.2
>
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux