lkml.org 
[lkml]   [2018]   [Dec]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] touchscreen: elants: fix a missing check of return values
Date
elants_i2c_send() may fail, let's check its return values. The fix does
the check and reports an error message upon the failure.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
drivers/input/touchscreen/elants_i2c.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c
index f2cb23121833..cb3c1470bb68 100644
--- a/drivers/input/touchscreen/elants_i2c.c
+++ b/drivers/input/touchscreen/elants_i2c.c
@@ -245,8 +245,14 @@ static int elants_i2c_calibrate(struct elants_data *ts)
ts->state = ELAN_WAIT_RECALIBRATION;
reinit_completion(&ts->cmd_done);

- elants_i2c_send(client, w_flashkey, sizeof(w_flashkey));
- elants_i2c_send(client, rek, sizeof(rek));
+ error = elants_i2c_send(client, w_flashkey, sizeof(w_flashkey));
+ error |= elants_i2c_send(client, rek, sizeof(rek));
+ if (error) {
+ dev_err(&client->dev,
+ "error in sending I2C messages for calibration: %d\n",
+ error);
+ return error;
+ }

enable_irq(client->irq);

--
2.17.2 (Apple Git-113)
\
 
 \ /
  Last update: 2018-12-21 08:05    [W:0.035 / U:0.992 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site