mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-10-26 10:57:38 +08:00
spmi: mtk-pmif: Fix clock reference leak in mtk_spmi_bus_probe()
of_clk_get_by_name() returns a reference that must be released with
clk_put(). If the lookup of a later clock fails, the function returns
without releasing the clocks that were already obtained. Put those
clocks before returning.
Fixes: 078117963b ("spmi: mtk-pmif: Add multi-bus support for SPMI 2.0")
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
Reviewed-by: Abel Vesa <abel.vesa@oss.qualcomm.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
This commit is contained in:
1 parent
c8f1aa6394
commit
636c4c026f
1 file changed
+3
-1
@@ -746,9 +746,11 @@ static int mtk_spmi_bus_probe(struct platform_device *pdev,
|
||||
for (i = 0; i < pbus->nclks; i++) {
|
||||
pbus->clks[i].id = pmif_clock_names[i];
|
||||
pbus->clks[i].clk = of_clk_get_by_name(node, pbus->clks[i].id);
|
||||
if (IS_ERR(pbus->clks[i].clk))
|
||||
if (IS_ERR(pbus->clks[i].clk)) {
|
||||
clk_bulk_put(i, pbus->clks);
|
||||
return dev_err_probe(&pdev->dev, PTR_ERR(pbus->clks[i].clk),
|
||||
"Failed to get clocks\n");
|
||||
}
|
||||
}
|
||||
|
||||
err = clk_bulk_prepare_enable(pbus->nclks, pbus->clks);
|
||||
|
||||
Reference in new issue
Block a user