diff mbox

[v3,1/5] regulator: of: Decrement refcount for suspend state nodes

Message ID 1413816472-1895-2-git-send-email-javier.martinez@collabora.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Javier Martinez Canillas Oct. 20, 2014, 2:47 p.m. UTC
of_get_regulation_constraints() calls of_get_child_by_name() to find the
regulator-state-{mem,disk} child nodes for each regulator. This function
increments the device node reference counter but this is not decremented
once the function is done using the node.

Fix that by calling of_node_put() after finishing using the device node.

Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
---
 drivers/regulator/of_regulator.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Mark Brown Oct. 22, 2014, 4:38 p.m. UTC | #1
On Mon, Oct 20, 2014 at 04:47:48PM +0200, Javier Martinez Canillas wrote:
> of_get_regulation_constraints() calls of_get_child_by_name() to find the
> regulator-state-{mem,disk} child nodes for each regulator. This function
> increments the device node reference counter but this is not decremented
> once the function is done using the node.

Applied, thanks.
diff mbox

Patch

diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c
index b375ffe..f0d19fc 100644
--- a/drivers/regulator/of_regulator.c
+++ b/drivers/regulator/of_regulator.c
@@ -107,6 +107,7 @@  static void of_get_regulation_constraints(struct device_node *np,
 					"regulator-off-in-suspend"))
 			suspend_state->disabled = true;
 
+		of_node_put(suspend_np);
 		suspend_state = NULL;
 		suspend_np = NULL;
 	}