* [PATCH] input/touchscreen: Fix a missing check on regmap_bulk_read
@ 2018-12-24 18:37 Aditya Pakki
2018-12-26 20:08 ` Dmitry Torokhov
0 siblings, 1 reply; 2+ messages in thread
From: Aditya Pakki @ 2018-12-24 18:37 UTC (permalink / raw)
To: pakki001
Cc: kjlu, Michael Hennerich, Dmitry Torokhov, linux-input,
linux-kernel
regmap_bulk_read() can return a non zero value on failure. The fix
checks if the function call succeeded before calling mod_timer.
Signed-off-by: Aditya Pakki <pakki001@umn.edu>
---
drivers/input/touchscreen/ad7879.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/input/touchscreen/ad7879.c b/drivers/input/touchscreen/ad7879.c
index 6bad23ee47a1..735cb4c0d913 100644
--- a/drivers/input/touchscreen/ad7879.c
+++ b/drivers/input/touchscreen/ad7879.c
@@ -247,11 +247,12 @@ static void ad7879_timer(struct timer_list *t)
static irqreturn_t ad7879_irq(int irq, void *handle)
{
struct ad7879 *ts = handle;
+ int ret;
- regmap_bulk_read(ts->regmap, AD7879_REG_XPLUS,
- ts->conversion_data, AD7879_NR_SENSE);
+ ret = regmap_bulk_read(ts->regmap, AD7879_REG_XPLUS,
+ ts->conversion_data, AD7879_NR_SENSE);
- if (!ad7879_report(ts))
+ if (!ret && !ad7879_report(ts))
mod_timer(&ts->timer, jiffies + TS_PEN_UP_TIMEOUT);
return IRQ_HANDLED;
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] input/touchscreen: Fix a missing check on regmap_bulk_read
2018-12-24 18:37 [PATCH] input/touchscreen: Fix a missing check on regmap_bulk_read Aditya Pakki
@ 2018-12-26 20:08 ` Dmitry Torokhov
0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Torokhov @ 2018-12-26 20:08 UTC (permalink / raw)
To: Aditya Pakki; +Cc: kjlu, Michael Hennerich, linux-input, linux-kernel
Hi,
On Mon, Dec 24, 2018 at 12:37:19PM -0600, Aditya Pakki wrote:
> regmap_bulk_read() can return a non zero value on failure. The fix
> checks if the function call succeeded before calling mod_timer.
>
> Signed-off-by: Aditya Pakki <pakki001@umn.edu>
> ---
> drivers/input/touchscreen/ad7879.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/input/touchscreen/ad7879.c b/drivers/input/touchscreen/ad7879.c
> index 6bad23ee47a1..735cb4c0d913 100644
> --- a/drivers/input/touchscreen/ad7879.c
> +++ b/drivers/input/touchscreen/ad7879.c
> @@ -247,11 +247,12 @@ static void ad7879_timer(struct timer_list *t)
> static irqreturn_t ad7879_irq(int irq, void *handle)
> {
> struct ad7879 *ts = handle;
> + int ret;
>
> - regmap_bulk_read(ts->regmap, AD7879_REG_XPLUS,
> - ts->conversion_data, AD7879_NR_SENSE);
> + ret = regmap_bulk_read(ts->regmap, AD7879_REG_XPLUS,
> + ts->conversion_data, AD7879_NR_SENSE);
I'd probably say:
error = regmap_bulk_read(...);
if (error)
dev_err_ratelimited(...);
else if (!ad7879_report(ts))
mod_timer(&ts->timer, jiffies + TS_PEN_UP_TIMEOUT);
Were the failures observed in real life or it is some kind of class
project?
>
> - if (!ad7879_report(ts))
> + if (!ret && !ad7879_report(ts))
> mod_timer(&ts->timer, jiffies + TS_PEN_UP_TIMEOUT);
>
> return IRQ_HANDLED;
> --
> 2.17.1
>
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-12-26 20:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-24 18:37 [PATCH] input/touchscreen: Fix a missing check on regmap_bulk_read Aditya Pakki
2018-12-26 20:08 ` Dmitry Torokhov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).