mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-28 12:53:14 +01:00
net: pcs: xpcs: fix clock reference leak on xpcs_init_clks failure
xpcs_init_clks() takes references with clk_bulk_get_optional() and then
enables them with clk_bulk_prepare_enable(). If the enable step fails,
the function returns without dropping the references.
xpcs_create() handles the failure through out_free_data, which calls
xpcs_free_data() but never xpcs_clear_clks(), so the clk references are
leaked.
Add the missing clk_bulk_put() on the enable failure path. The
prepare/enable side is already rolled back by
clk_bulk_prepare_enable() itself.
Fixes: f6bb3e9d98 ("net: pcs: xpcs: Add Synopsys DW xPCS platform device driver")
Signed-off-by: Coia Prant <[email protected]>
Reviewed-by: Simon Horman <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Paolo Abeni <[email protected]>
This commit is contained in:
1 parent
a87529034b
commit
9892d71cf0
1 file changed
+3
-1
@@ -1545,8 +1545,10 @@ static int xpcs_init_clks(struct dw_xpcs *xpcs)
|
||||
return dev_err_probe(dev, ret, "Failed to get clocks\n");
|
||||
|
||||
ret = clk_bulk_prepare_enable(DW_XPCS_NUM_CLKS, xpcs->clks);
|
||||
if (ret)
|
||||
if (ret) {
|
||||
clk_bulk_put(DW_XPCS_NUM_CLKS, xpcs->clks);
|
||||
return dev_err_probe(dev, ret, "Failed to enable clocks\n");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user