public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] driver: input: 88pm860x-ts: fix missing of_node_put
@ 2013-08-31  6:44 Libo Chen
  0 siblings, 0 replies; only message in thread
From: Libo Chen @ 2013-08-31  6:44 UTC (permalink / raw)
  To: dmitry.torokhov
  Cc: peter.ujfalusi, Bill Pemberton, broonie, linux-input, LKML,
	Li Zefan, zhangwei(Jovi)


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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2013-08-31  6:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-31  6:44 [PATCH 1/3] driver: input: 88pm860x-ts: fix missing of_node_put Libo Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox