mirror of
https://github.com/torvalds/linux.git
synced 2026-10-07 11:06:03 +02:00
fsl/fman: Fix clk reference leak in read_dts_node()
of_clk_get() returns a clock with its reference count incremented, but
read_dts_node() only uses it to read the rate and never calls clk_put().
The clock is not stored anywhere, so the reference cannot be released
later either.
Release the clock once its rate has been read, which also covers the
error path taken when the rate is zero.
Fixes: 414fd46e77 ("fsl/fman: Add FMan support")
Cc: stable@vger.kernel.org
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20260917110135.2148068-1-vulab@iscas.ac.cn
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
a92e1a412c
commit
a644f09b20
|
|
@ -2734,6 +2734,7 @@ static struct fman *read_dts_node(struct platform_device *of_dev)
|
|||
}
|
||||
|
||||
clk_rate = clk_get_rate(clk);
|
||||
clk_put(clk);
|
||||
if (!clk_rate) {
|
||||
err = -EINVAL;
|
||||
dev_err(&of_dev->dev, "%s: Failed to determine FM%d clock rate\n",
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user