Skip to content

Commit 3f4e432

Browse files
committed
gpio: pxa: use devres for the clock struct
The clock is never released after probe(). Use devres to not leak resources. Reported-by: Hulk Robot <hulkci@huawei.com> Reported-by: Yuan Can <yuancan@huawei.com> Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
1 parent 636c398 commit 3f4e432

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

drivers/gpio/gpio-pxa.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -661,24 +661,17 @@ static int pxa_gpio_probe(struct platform_device *pdev)
661661
if (IS_ERR(gpio_reg_base))
662662
return PTR_ERR(gpio_reg_base);
663663

664-
clk = clk_get(&pdev->dev, NULL);
664+
clk = devm_clk_get_enabled(&pdev->dev, NULL);
665665
if (IS_ERR(clk)) {
666666
dev_err(&pdev->dev, "Error %ld to get gpio clock\n",
667667
PTR_ERR(clk));
668668
return PTR_ERR(clk);
669669
}
670-
ret = clk_prepare_enable(clk);
671-
if (ret) {
672-
clk_put(clk);
673-
return ret;
674-
}
675670

676671
/* Initialize GPIO chips */
677672
ret = pxa_init_gpio_chip(pchip, pxa_last_gpio + 1, gpio_reg_base);
678-
if (ret) {
679-
clk_put(clk);
673+
if (ret)
680674
return ret;
681-
}
682675

683676
/* clear all GPIO edge detects */
684677
for_each_gpio_bank(gpio, c, pchip) {

0 commit comments

Comments
 (0)