mirror of
https://github.com/torvalds/linux.git
synced 2026-11-06 21:58:01 +01:00
pinctrl: nuvoton: Fix clock reference leak in ma35_get_bank_data()
ma35_get_bank_data() obtains the bank clock with of_clk_get() and
stores it in bank->clk, but returns clk_prepare_enable() directly. If
that call fails, the reference taken by of_clk_get() is never dropped,
and the driver has no other clk_put() for it.
Drop the reference when clk_prepare_enable() fails.
Fixes: f805e35631 ("pinctrl: nuvoton: Add ma35d1 pinctrl and GPIO driver")
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
Signed-off-by: Linus Walleij <linusw@kernel.org>
This commit is contained in:
parent
c2d996d9c6
commit
a854aa8e55
|
|
@ -557,6 +557,8 @@ static int ma35_gpiolib_register(struct platform_device *pdev, struct ma35_pinct
|
|||
|
||||
static int ma35_get_bank_data(struct ma35_pin_bank *bank)
|
||||
{
|
||||
int ret;
|
||||
|
||||
bank->reg_base = fwnode_iomap(bank->fwnode, 0);
|
||||
if (!bank->reg_base)
|
||||
return -ENOMEM;
|
||||
|
|
@ -569,7 +571,11 @@ static int ma35_get_bank_data(struct ma35_pin_bank *bank)
|
|||
if (IS_ERR(bank->clk))
|
||||
return PTR_ERR(bank->clk);
|
||||
|
||||
return clk_prepare_enable(bank->clk);
|
||||
ret = clk_prepare_enable(bank->clk);
|
||||
if (ret)
|
||||
clk_put(bank->clk);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int ma35_pinctrl_get_soc_data(struct ma35_pinctrl *pctl, struct platform_device *pdev)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user