summaryrefslogtreecommitdiff
path: root/drivers/input
diff options
context:
space:
mode:
authorVenkata Prahlad Valluru <vvalluru@codeaurora.org>2018-03-13 15:47:23 +0530
committerVenkata Prahlad Valluru <vvalluru@codeaurora.org>2018-03-14 09:18:59 +0530
commit6feaa135ad5d137f69cd624e17dcd8c809379a29 (patch)
treea5be8cf8cbde8cb9cb49cd8acee02bc6a8af4036 /drivers/input
parenta337c17cebeadebddd57cfae9d7953567969be06 (diff)
input: touchscreen: Handle failure case in Atmel driver
Handle file already exists and failure case separately. Change-Id: I0c8004c88feb323b592ad8f622f86fe66cb63006 Signed-off-by: Venkata Prahlad Valluru <vvalluru@codeaurora.org>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/touchscreen/atmel_maxtouch_ts.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/drivers/input/touchscreen/atmel_maxtouch_ts.c b/drivers/input/touchscreen/atmel_maxtouch_ts.c
index f58fc8555156..9aa57c176d97 100644
--- a/drivers/input/touchscreen/atmel_maxtouch_ts.c
+++ b/drivers/input/touchscreen/atmel_maxtouch_ts.c
@@ -1,7 +1,7 @@
/*
* Atmel maXTouch Touchscreen driver
*
- * Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2015, 2018 The Linux Foundation. All rights reserved.
*
* Linux foundation chooses to take subject only to the GPLv2 license terms,
* and distributes only under these terms.
@@ -529,6 +529,8 @@ static ssize_t mxt_debug_msg_read(struct file *filp, struct kobject *kobj,
static int mxt_debug_msg_init(struct mxt_data *data)
{
+ int ret;
+
sysfs_bin_attr_init(&data->debug_msg_attr);
data->debug_msg_attr.attr.name = "debug_msg";
data->debug_msg_attr.attr.mode = 0666;
@@ -536,11 +538,20 @@ static int mxt_debug_msg_init(struct mxt_data *data)
data->debug_msg_attr.write = mxt_debug_msg_write;
data->debug_msg_attr.size = data->T5_msg_size * DEBUG_MSG_MAX;
- if (sysfs_create_bin_file(&data->client->dev.kobj,
- &data->debug_msg_attr) < 0)
- dev_info(&data->client->dev, "Debugfs already exists\n");
+ ret = sysfs_create_bin_file(&data->client->dev.kobj,
+ &data->debug_msg_attr);
+ if (ret < 0) {
+ if (ret == -EEXIST) {
+ dev_info(&data->client->dev,
+ "Debugfs already exists\n");
+ ret = 0;
+ } else {
+ dev_err(&data->client->dev,
+ "Failed to create 'debug_msg' file\n");
+ }
+ }
- return 0;
+ return ret;
}
static void mxt_debug_msg_remove(struct mxt_data *data)