summaryrefslogtreecommitdiff
path: root/drivers/input
diff options
context:
space:
mode:
authorShantanu Jain <shjain@codeaurora.org>2016-01-22 17:09:27 +0530
committerAbinaya P <abinayap@codeaurora.org>2016-08-05 20:26:29 +0530
commitfdcb967e7ebd5d37e9a2601ae101ce3352d2ee60 (patch)
tree9850e5da6c5ff0cff8501df3a395fdddac341dc0 /drivers/input
parent28181fbc4c585466a0eaebe95d7506f1b57029b7 (diff)
input: touchscreen: correct condition checks in ITE tech touch driver
Correct the return value check of kstrtoint function. Also correct the platform_data parsing check in ITE tech touch driver. This is a propagated patch from 3.18 kernel 'commit 9a1496537aeb ("input: touchscreen: correct condition checks in ITE tech touch driver")' Change-Id: I792c043ca4d85e236c209605e80392a05d26b983 Signed-off-by: Shantanu Jain <shjain@codeaurora.org>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/touchscreen/it7258_ts_i2c.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/input/touchscreen/it7258_ts_i2c.c b/drivers/input/touchscreen/it7258_ts_i2c.c
index 44abee361db4..f7b873e56c6d 100644
--- a/drivers/input/touchscreen/it7258_ts_i2c.c
+++ b/drivers/input/touchscreen/it7258_ts_i2c.c
@@ -1,7 +1,7 @@
/* drivers/input/touchscreen/it7258_ts_i2c.c
*
* Copyright (C) 2014 ITE Tech. Inc.
- * Copyright (c) 2015, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -627,7 +627,7 @@ static ssize_t sysfs_fw_upgrade_store(struct device *dev,
}
ret = kstrtoint(buf, 10, &mode);
- if (!ret) {
+ if (ret) {
dev_err(dev, "failed to read input for sysfs\n");
return -EINVAL;
}
@@ -660,7 +660,7 @@ static ssize_t sysfs_cfg_upgrade_store(struct device *dev,
}
ret = kstrtoint(buf, 10, &mode);
- if (!ret) {
+ if (ret) {
dev_err(dev, "failed to read input for sysfs\n");
return -EINVAL;
}
@@ -707,7 +707,7 @@ static ssize_t sysfs_force_fw_upgrade_store(struct device *dev,
}
ret = kstrtoint(buf, 10, &mode);
- if (!ret) {
+ if (ret) {
dev_err(dev, "failed to read input for sysfs\n");
return -EINVAL;
}
@@ -740,7 +740,7 @@ static ssize_t sysfs_force_cfg_upgrade_store(struct device *dev,
}
ret = kstrtoint(buf, 10, &mode);
- if (!ret) {
+ if (ret) {
dev_err(dev, "failed to read input for sysfs\n");
return -EINVAL;
}
@@ -1598,9 +1598,6 @@ static int IT7260_ts_probe(struct i2c_client *client,
gl_ts->client = client;
i2c_set_clientdata(client, gl_ts);
- if (client->dev.platform_data == NULL)
- return -ENODEV;
-
if (client->dev.of_node) {
pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL);
if (!pdata)
@@ -1613,8 +1610,10 @@ static int IT7260_ts_probe(struct i2c_client *client,
pdata = client->dev.platform_data;
}
- if (!pdata)
+ if (!pdata) {
+ dev_err(&client->dev, "No platform data found\n");
return -ENOMEM;
+ }
gl_ts->pdata = pdata;