]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
staging: typec: fusb302: do not free gpio from managed resource
authorRui Miguel Silva <rmfrfs@gmail.com>
Fri, 12 May 2017 20:16:13 +0000 (21:16 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 15 May 2017 09:37:26 +0000 (11:37 +0200)
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@gmail.com>
Acked-by: Yueyao Zhu <yueyao.zhu@gmail.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/typec/fusb302/fusb302.c

index d8b50b49bb2d3cca2982e7f8a387e8d62fba1a94..ef5cceaa5967bf0321b455e62ae962337a06bf50 100644 (file)
@@ -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;