mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
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>
This commit is contained in:
parent
636c3982d2
commit
3f4e432fb9
1 changed files with 2 additions and 9 deletions
|
@ -661,24 +661,17 @@ static int pxa_gpio_probe(struct platform_device *pdev)
|
||||||
if (IS_ERR(gpio_reg_base))
|
if (IS_ERR(gpio_reg_base))
|
||||||
return PTR_ERR(gpio_reg_base);
|
return PTR_ERR(gpio_reg_base);
|
||||||
|
|
||||||
clk = clk_get(&pdev->dev, NULL);
|
clk = devm_clk_get_enabled(&pdev->dev, NULL);
|
||||||
if (IS_ERR(clk)) {
|
if (IS_ERR(clk)) {
|
||||||
dev_err(&pdev->dev, "Error %ld to get gpio clock\n",
|
dev_err(&pdev->dev, "Error %ld to get gpio clock\n",
|
||||||
PTR_ERR(clk));
|
PTR_ERR(clk));
|
||||||
return PTR_ERR(clk);
|
return PTR_ERR(clk);
|
||||||
}
|
}
|
||||||
ret = clk_prepare_enable(clk);
|
|
||||||
if (ret) {
|
|
||||||
clk_put(clk);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initialize GPIO chips */
|
/* Initialize GPIO chips */
|
||||||
ret = pxa_init_gpio_chip(pchip, pxa_last_gpio + 1, gpio_reg_base);
|
ret = pxa_init_gpio_chip(pchip, pxa_last_gpio + 1, gpio_reg_base);
|
||||||
if (ret) {
|
if (ret)
|
||||||
clk_put(clk);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
|
||||||
|
|
||||||
/* clear all GPIO edge detects */
|
/* clear all GPIO edge detects */
|
||||||
for_each_gpio_bank(gpio, c, pchip) {
|
for_each_gpio_bank(gpio, c, pchip) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue