From fdcb967e7ebd5d37e9a2601ae101ce3352d2ee60 Mon Sep 17 00:00:00 2001 From: Shantanu Jain Date: Fri, 22 Jan 2016 17:09:27 +0530 Subject: [PATCH] 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 --- drivers/input/touchscreen/it7258_ts_i2c.c | 17 ++++++++--------- 1 file 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; -- 2.11.0