From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Aditya Pakki <pakki001@umn.edu>
Cc: kjlu@umn.edu, Michael Hennerich <michael.hennerich@analog.com>,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] [v2] Input: touchscreen: Fix a missing check on regmap_bulk_read
Date: Mon, 7 Jan 2019 12:00:26 -0800 [thread overview]
Message-ID: <20190107200026.GD141497@dtor-ws> (raw)
In-Reply-To: <20190106181727.11815-1-pakki001@umn.edu>
On Sun, Jan 06, 2019 at 12:17:27PM -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. The
> issue was identified by a static analysis tool.
>
> Signed-off-by: Aditya Pakki <pakki001@umn.edu>
Applied, thank you.
> ---
> drivers/input/touchscreen/ad7879.c | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/input/touchscreen/ad7879.c b/drivers/input/touchscreen/ad7879.c
> index 6fa714c587b4..8c908572c1f2 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;
> --
> 2.17.1
>
--
Dmitry
prev parent reply other threads:[~2019-01-07 20:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-06 18:17 [PATCH] [v2] Input: touchscreen: Fix a missing check on regmap_bulk_read Aditya Pakki
2019-01-07 20:00 ` Dmitry Torokhov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190107200026.GD141497@dtor-ws \
--to=dmitry.torokhov@gmail.com \
--cc=kjlu@umn.edu \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.hennerich@analog.com \
--cc=pakki001@umn.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.