• Nishka Dasgupta's avatar
    PCI: tegra: Fix OF node reference leak · 9e38e690
    Nishka Dasgupta authored
    Each iteration of for_each_child_of_node() executes of_node_put() on the
    previous node, but in some return paths in the middle of the loop
    of_node_put() is missing thus causing a reference leak.
    
    Hence stash these mid-loop return values in a variable 'err' and add a
    new label err_node_put which executes of_node_put() on the previous node
    and returns 'err' on failure.
    
    Change mid-loop return statements to point to jump to this label to
    fix the reference leak.
    
    Issue found with Coccinelle.
    Signed-off-by: default avatarNishka Dasgupta <nishkadg.linux@gmail.com>
    [lorenzo.pieralisi@arm.com: rewrote commit log]
    Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
    9e38e690
pci-tegra.c 76.2 KB