Skip to content

Commit

Permalink
regulator: rk808: Fix missing of_node_put
Browse files Browse the repository at this point in the history
1. Pass &pdev->dev rather than &client->dev to of_regulator_match, the *dev
   argument is used for devres to ensure devm_of_regulator_put_matches() will
   be called when unload the module.

2. of_get_child_by_name() returns a node pointer with refcount incremented.
   Thus add missing of_node_put(reg_np).

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Axel Lin authored and Mark Brown committed Sep 12, 2014
1 parent 1f0c016 commit 1ed3f8c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/regulator/rk808-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,9 @@ static int rk808_regulator_probe(struct platform_device *pdev)
if (!reg_np)
return -ENXIO;

ret = of_regulator_match(&client->dev, reg_np, rk808_reg_matches,
ret = of_regulator_match(&pdev->dev, reg_np, rk808_reg_matches,
RK808_NUM_REGULATORS);
of_node_put(reg_np);
if (ret < 0)
return ret;

Expand Down

0 comments on commit 1ed3f8c

Please sign in to comment.