mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 20:54:03 +02:00
firmware: arm_scpi: fix device_node leak in scpi_dev_domain_id
of_parse_phandle_with_args() takes a reference on clkspec.np that must be released with of_node_put(). scpi_dev_domain_id() returned clkspec.args[0] without dropping that reference, so every domain lookup leaked a device node. Paths such as scpi_dvfs_info() / cpufreq init call this per CPU, so the leak accumulates over time. Save the domain id, of_node_put(clkspec.np), then return the saved value. Signed-off-by: Xixin Liu <liuxixin@kylinos.cn> Link: https://patch.msgid.link/84fdd490495b.v2.1785200642.git.liuxixin@kylinos.cn Signed-off-by: Sudeep Holla <sudeep.holla@kernel.org>
This commit is contained in:
parent
cee9395acd
commit
65320b6420
|
|
@ -661,12 +661,15 @@ static struct scpi_dvfs_info *scpi_dvfs_get_info(u8 domain)
|
|||
static int scpi_dev_domain_id(struct device *dev)
|
||||
{
|
||||
struct of_phandle_args clkspec;
|
||||
int domain;
|
||||
|
||||
if (of_parse_phandle_with_args(dev->of_node, "clocks", "#clock-cells",
|
||||
0, &clkspec))
|
||||
return -EINVAL;
|
||||
|
||||
return clkspec.args[0];
|
||||
domain = clkspec.args[0];
|
||||
of_node_put(clkspec.np);
|
||||
return domain;
|
||||
}
|
||||
|
||||
static struct scpi_dvfs_info *scpi_dvfs_info(struct device *dev)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user