public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Axel Lin <axel.lin@ingics.com>
To: Mark Brown <broonie@kernel.org>
Cc: Chris Zhong <zyw@rock-chips.com>,
	Doug Anderson <dianders@chromium.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [PATCH 2/2] regulator: rk808: Fix missing of_node_put
Date: Thu, 11 Sep 2014 18:22:48 +0800	[thread overview]
Message-ID: <1410430968.32479.2.camel@phoenix> (raw)
In-Reply-To: <1410430870.32479.0.camel@phoenix>

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>
---
 drivers/regulator/rk808-regulator.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/regulator/rk808-regulator.c b/drivers/regulator/rk808-regulator.c
index 9557428..07b0eb4 100644
--- a/drivers/regulator/rk808-regulator.c
+++ b/drivers/regulator/rk808-regulator.c
@@ -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;
 
-- 
1.9.1




  reply	other threads:[~2014-09-11 10:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-11 10:21 [PATCH 1/2] regulator: rk808: Remove unused variables Axel Lin
2014-09-11 10:22 ` Axel Lin [this message]
2014-09-12 22:28   ` [PATCH 2/2] regulator: rk808: Fix missing of_node_put Doug Anderson
2014-09-12 13:53 ` [PATCH 1/2] regulator: rk808: Remove unused variables Mark Brown
2014-09-12 22:20 ` Doug Anderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1410430968.32479.2.camel@phoenix \
    --to=axel.lin@ingics.com \
    --cc=broonie@kernel.org \
    --cc=dianders@chromium.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zyw@rock-chips.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox