summaryrefslogtreecommitdiffstats
path: root/drivers/input/touchscreen/ad7879.c
diff options
context:
space:
mode:
authorAditya Pakki <pakki001@umn.edu>2019-01-07 11:53:59 -0800
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2019-01-07 11:59:57 -0800
commite85bb0beb6498c0dffe18a2f1f16d575bc175c32 (patch)
tree59b68bc824a4efc4515f8782cc4f53b0c363d4d2 /drivers/input/touchscreen/ad7879.c
parent1cdbd3e57698fa22eddb522b2c7fa6048420da5f (diff)
downloadlinux-e85bb0beb6498c0dffe18a2f1f16d575bc175c32.tar.gz
linux-e85bb0beb6498c0dffe18a2f1f16d575bc175c32.tar.bz2
linux-e85bb0beb6498c0dffe18a2f1f16d575bc175c32.zip
Input: ad7879 - add check for read errors in interrupt
regmap_bulk_read() can return a non zero value on failure. The fix checks if the function call succeeded before calling mod_timer. The issue was identified by a static analysis tool. Signed-off-by: Aditya Pakki <pakki001@umn.edu> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/touchscreen/ad7879.c')
-rw-r--r--drivers/input/touchscreen/ad7879.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/input/touchscreen/ad7879.c b/drivers/input/touchscreen/ad7879.c
index 6fa714c587b4..3a016f43fb85 100644
--- a/drivers/input/touchscreen/ad7879.c
+++ b/drivers/input/touchscreen/ad7879.c
@@ -246,11 +246,14 @@ static void ad7879_timer(struct timer_list *t)
static irqreturn_t ad7879_irq(int irq, void *handle)
{
struct ad7879 *ts = handle;
+ int error;
- regmap_bulk_read(ts->regmap, AD7879_REG_XPLUS,
- ts->conversion_data, AD7879_NR_SENSE);
-
- if (!ad7879_report(ts))
+ error = regmap_bulk_read(ts->regmap, AD7879_REG_XPLUS,
+ ts->conversion_data, AD7879_NR_SENSE);
+ if (error)
+ dev_err_ratelimited(ts->dev, "failed to read %#02x: %d\n",
+ AD7879_REG_XPLUS, error);
+ else if (!ad7879_report(ts))
mod_timer(&ts->timer, jiffies + TS_PEN_UP_TIMEOUT);
return IRQ_HANDLED;