From: Linus Walleij <linus.walleij@linaro.org>
To: David Rivshin <drivshin@awxrd.com>
Cc: "linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
Linux-OMAP <linux-omap@vger.kernel.org>,
Grygorii Strashko <grygorii.strashko@ti.com>,
Santosh Shilimkar <ssantosh@kernel.org>,
Kevin Hilman <khilman@kernel.org>,
Alexandre Courbot <gnurou@gmail.com>,
linux-arm@vger.kernel.org,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
stable <stable@vger.kernel.org>
Subject: Re: [PATCH v2] gpio: omap: return error if requested debounce time is not possible
Date: Fri, 28 Apr 2017 09:51:05 +0200 [thread overview]
Message-ID: <CACRpkdYNCk9SdK+H4rTqdchvTZ+xyzMVVhpJJyD95iboSwaxEg@mail.gmail.com> (raw)
In-Reply-To: <20170424225650.17566-1-drivshin@awxrd.com>
On Tue, Apr 25, 2017 at 12:56 AM, David Rivshin <drivshin@awxrd.com> wrote:
> From: David Rivshin <DRivshin@allworx.com>
>
> omap_gpio_debounce() does not validate that the requested debounce
> is within a range it can handle. Instead it lets the register value
> wrap silently, and always returns success.
>
> This can lead to all sorts of unexpected behavior, such as gpio_keys
> asking for a too-long debounce, but getting a very short debounce in
> practice.
>
> Fix this by returning -EINVAL if the requested value does not fit into
> the register field. If there is no debounce clock available at all,
> return -ENOTSUPP.
>
> Fixes: e85ec6c3047b ("gpio: omap: fix omap2_set_gpio_debounce")
> Cc: <stable@vger.kernel.org> # 4.3+
> Signed-off-by: David Rivshin <drivshin@allworx.com>
> ---
> Changes since v1 (https://lkml.org/lkml/2017/3/16/1094):
> - Added dev_info() in omap_gpio_debounce() on error.
Patch applied with Grygorii's ACK.
Yours,
Linus Walleij
prev parent reply other threads:[~2017-04-28 7:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-24 22:56 [PATCH v2] gpio: omap: return error if requested debounce time is not possible David Rivshin
2017-04-25 20:35 ` Grygorii Strashko
2017-04-28 7:51 ` Linus Walleij [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=CACRpkdYNCk9SdK+H4rTqdchvTZ+xyzMVVhpJJyD95iboSwaxEg@mail.gmail.com \
--to=linus.walleij@linaro.org \
--cc=drivshin@awxrd.com \
--cc=gnurou@gmail.com \
--cc=grygorii.strashko@ti.com \
--cc=khilman@kernel.org \
--cc=linux-arm@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=ssantosh@kernel.org \
--cc=stable@vger.kernel.org \
/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 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).