All of lore.kernel.org
 help / color / mirror / Atom feed
From: Libo Chen <clbchenlibo.chen@huawei.com>
To: dmitry.torokhov@gmail.com
Cc: peter.ujfalusi@ti.com, Bill Pemberton <wfp5p@virginia.edu>,
	broonie@opensource.wolfsonmicro.com, linux-input@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>,
	Li Zefan <lizefan@huawei.com>,
	"zhangwei(Jovi)" <jovi.zhangwei@huawei.com>
Subject: [PATCH 1/3] driver: input: 88pm860x-ts: fix missing of_node_put
Date: Sat, 31 Aug 2013 14:44:57 +0800	[thread overview]
Message-ID: <522190E9.9000007@huawei.com> (raw)


decrease np device_node refcount after task completion

Signed-off-by: Libo Chen <libo.chen@huawei.com>
---
 drivers/input/touchscreen/88pm860x-ts.c |   22 +++++++++++++++-------
 1 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/drivers/input/touchscreen/88pm860x-ts.c b/drivers/input/touchscreen/88pm860x-ts.c
index f7de14a..4a2fd46 100644
--- a/drivers/input/touchscreen/88pm860x-ts.c
+++ b/drivers/input/touchscreen/88pm860x-ts.c
@@ -142,14 +142,18 @@ static int pm860x_touch_dt_init(struct platform_device *pdev,
 		data |= (n << 7) & PM8607_GPADC_SW_CAL_MASK;
 	if (data) {
 		ret = pm860x_reg_write(i2c, PM8607_GPADC_MISC1, data);
-		if (ret < 0)
-			return -EINVAL;
+		if (ret < 0) {
+			ret = -EINVAL;
+			goto err;
+		}
 	}
 	/* set tsi prebias time */
 	if (!of_property_read_u32(np, "marvell,88pm860x-tsi-prebias", &data)) {
 		ret = pm860x_reg_write(i2c, PM8607_TSI_PREBIAS, data);
-		if (ret < 0)
-			return -EINVAL;
+		if (ret < 0) {
+			ret = -EINVAL;
+			goto err;
+		}
 	}
 	/* set prebias & prechg time of pen detect */
 	data = 0;
@@ -159,11 +163,15 @@ static int pm860x_touch_dt_init(struct platform_device *pdev,
 		data |= n & PM8607_PD_PRECHG_MASK;
 	if (data) {
 		ret = pm860x_reg_write(i2c, PM8607_PD_PREBIAS, data);
-		if (ret < 0)
-			return -EINVAL;
+		if (ret < 0) {
+			ret = -EINVAL;
+			goto err;
+		}
 	}
 	of_property_read_u32(np, "marvell,88pm860x-resistor-X", res_x);
-	return 0;
+err:
+	of_node_put(np);
+	return ret;
 }
 #else
 #define pm860x_touch_dt_init(x, y, z)	(-1)
-- 
1.7.1

WARNING: multiple messages have this Message-ID (diff)
From: Libo Chen <clbchenlibo.chen@huawei.com>
To: <dmitry.torokhov@gmail.com>
Cc: <peter.ujfalusi@ti.com>, Bill Pemberton <wfp5p@virginia.edu>,
	<broonie@opensource.wolfsonmicro.com>,
	<linux-input@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Li Zefan <lizefan@huawei.com>,
	"zhangwei(Jovi)" <jovi.zhangwei@huawei.com>
Subject: [PATCH 1/3] driver: input: 88pm860x-ts: fix missing of_node_put
Date: Sat, 31 Aug 2013 14:44:57 +0800	[thread overview]
Message-ID: <522190E9.9000007@huawei.com> (raw)


decrease np device_node refcount after task completion

Signed-off-by: Libo Chen <libo.chen@huawei.com>
---
 drivers/input/touchscreen/88pm860x-ts.c |   22 +++++++++++++++-------
 1 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/drivers/input/touchscreen/88pm860x-ts.c b/drivers/input/touchscreen/88pm860x-ts.c
index f7de14a..4a2fd46 100644
--- a/drivers/input/touchscreen/88pm860x-ts.c
+++ b/drivers/input/touchscreen/88pm860x-ts.c
@@ -142,14 +142,18 @@ static int pm860x_touch_dt_init(struct platform_device *pdev,
 		data |= (n << 7) & PM8607_GPADC_SW_CAL_MASK;
 	if (data) {
 		ret = pm860x_reg_write(i2c, PM8607_GPADC_MISC1, data);
-		if (ret < 0)
-			return -EINVAL;
+		if (ret < 0) {
+			ret = -EINVAL;
+			goto err;
+		}
 	}
 	/* set tsi prebias time */
 	if (!of_property_read_u32(np, "marvell,88pm860x-tsi-prebias", &data)) {
 		ret = pm860x_reg_write(i2c, PM8607_TSI_PREBIAS, data);
-		if (ret < 0)
-			return -EINVAL;
+		if (ret < 0) {
+			ret = -EINVAL;
+			goto err;
+		}
 	}
 	/* set prebias & prechg time of pen detect */
 	data = 0;
@@ -159,11 +163,15 @@ static int pm860x_touch_dt_init(struct platform_device *pdev,
 		data |= n & PM8607_PD_PRECHG_MASK;
 	if (data) {
 		ret = pm860x_reg_write(i2c, PM8607_PD_PREBIAS, data);
-		if (ret < 0)
-			return -EINVAL;
+		if (ret < 0) {
+			ret = -EINVAL;
+			goto err;
+		}
 	}
 	of_property_read_u32(np, "marvell,88pm860x-resistor-X", res_x);
-	return 0;
+err:
+	of_node_put(np);
+	return ret;
 }
 #else
 #define pm860x_touch_dt_init(x, y, z)	(-1)
-- 
1.7.1


             reply	other threads:[~2013-08-31  6:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-31  6:44 Libo Chen [this message]
2013-08-31  6:44 ` [PATCH 1/3] driver: input: 88pm860x-ts: fix missing of_node_put Libo Chen

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=522190E9.9000007@huawei.com \
    --to=clbchenlibo.chen@huawei.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=jovi.zhangwei@huawei.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan@huawei.com \
    --cc=peter.ujfalusi@ti.com \
    --cc=wfp5p@virginia.edu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.