phy: qualcomm: phy-qcom-qmp: Add of_node_put() before return
authorNishka Dasgupta <nishkadg.linux@gmail.com>
Thu, 8 Aug 2019 07:29:37 +0000 (12:59 +0530)
committerKishon Vijay Abraham I <kishon@ti.com>
Mon, 26 Aug 2019 11:50:02 +0000 (17:20 +0530)
commitbe0345b2cc1f3e6044409b274c61bc44d59f640d
treefd378e67bec89e9293a4800be550baa3920286ad
parente6839c31a608e79f2057fab987dd814f5d3477e6
phy: qualcomm: phy-qcom-qmp: Add of_node_put() before return

Each iteration of for_each_available_child_of_node() puts the previous
node, but in the case of a return from the middle of the loop, there is
no put, thus causing a memory leak. Hence create a new label,
err_node_put, that puts the previous node (child) before returning the
required value. Also include the statement pm_runtime_disable() under
this label in order to avoid repetition among mid-loop return
conditions. Edit the mid-loop return statements to instead go to this
new label err_node_put.
Issue found with Coccinelle.

Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
drivers/phy/qualcomm/phy-qcom-qmp.c