mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 01:24:47 +01:00
pinctrl: meson: amlogic-a4: Fix device node reference leak in aml_dt_node_to_map_pinmux()
The of_get_parent() function returns a device_node with an incremented
reference count.
Use the __free(device_node) cleanup attribute to ensure of_node_put()
is automatically called when pnode goes out of scope, fixing a
reference leak.
Fixes: 6e9be3abb7 ("pinctrl: Add driver support for Amlogic SoCs")
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
Signed-off-by: Linus Walleij <linusw@kernel.org>
This commit is contained in:
parent
e9e268ea9d
commit
a2539b92e4
1 changed files with 1 additions and 2 deletions
|
|
@ -679,7 +679,6 @@ static int aml_dt_node_to_map_pinmux(struct pinctrl_dev *pctldev,
|
|||
unsigned int *num_maps)
|
||||
{
|
||||
struct device *dev = pctldev->dev;
|
||||
struct device_node *pnode;
|
||||
unsigned long *configs = NULL;
|
||||
unsigned int num_configs = 0;
|
||||
struct property *prop;
|
||||
|
|
@ -693,7 +692,7 @@ static int aml_dt_node_to_map_pinmux(struct pinctrl_dev *pctldev,
|
|||
return -ENOENT;
|
||||
}
|
||||
|
||||
pnode = of_get_parent(np);
|
||||
struct device_node *pnode __free(device_node) = of_get_parent(np);
|
||||
if (!pnode) {
|
||||
dev_info(dev, "Missing function node\n");
|
||||
return -EINVAL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue