Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: 6e9be3abb78c ("pinctrl: Add driver support for Amlogic SoCs")
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
Signed-off-by: Linus Walleij <linusw@kernel.org>

authored by

Felix Gu and committed by
Linus Walleij
a2539b92 e9e268ea

+1 -2
+1 -2
drivers/pinctrl/meson/pinctrl-amlogic-a4.c
··· 679 679 unsigned int *num_maps) 680 680 { 681 681 struct device *dev = pctldev->dev; 682 - struct device_node *pnode; 683 682 unsigned long *configs = NULL; 684 683 unsigned int num_configs = 0; 685 684 struct property *prop; ··· 692 693 return -ENOENT; 693 694 } 694 695 695 - pnode = of_get_parent(np); 696 + struct device_node *pnode __free(device_node) = of_get_parent(np); 696 697 if (!pnode) { 697 698 dev_info(dev, "Missing function node\n"); 698 699 return -EINVAL;