From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Ksenija Stanojevic <ksenija.stanojevic@gmail.com>,
Lee Jones <lee.jones@linaro.org>, Marek Vasut <marex@denx.de>,
linux-input@vger.kernel.org, kernel-janitors@vger.kernel.org,
linux-iio@vger.kernel.org
Subject: Re: [PATCH 2/2] input: touchscreen: mxs-lradc: || vs && typos
Date: Wed, 26 Apr 2017 14:12:31 -0700 [thread overview]
Message-ID: <20170426211231.GA34586@dtor-ws> (raw)
In-Reply-To: <20170426210431.mqze5ehrijm7l2ey@mwanda>
On Thu, Apr 27, 2017 at 12:04:31AM +0300, Dan Carpenter wrote:
> These tests are meaningless as is because "adapt" can't possibly be both
> less than 1 and greater than 32.
>
> Fixes: d81ca730e3e4 ("input: touchscreen: mxs-lradc: Add support for touchscreen")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Lee, could you take this one?
> diff --git a/drivers/input/touchscreen/mxs-lradc-ts.c b/drivers/input/touchscreen/mxs-lradc-ts.c
> index ff9cda29d9a0..369ef83234ef 100644
> --- a/drivers/input/touchscreen/mxs-lradc-ts.c
> +++ b/drivers/input/touchscreen/mxs-lradc-ts.c
> @@ -642,7 +642,7 @@ static int mxs_lradc_ts_probe(struct platform_device *pdev)
> if (of_property_read_u32(node, "fsl,ave-ctrl", &adapt)) {
> ts->over_sample_cnt = 4;
> } else {
> - if (adapt >= 1 || adapt <= 32) {
> + if (adapt >= 1 && adapt <= 32) {
> ts->over_sample_cnt = adapt;
> } else {
> dev_err(ts->dev, "Invalid sample count (%u)\n",
> @@ -654,7 +654,7 @@ static int mxs_lradc_ts_probe(struct platform_device *pdev)
> if (of_property_read_u32(node, "fsl,ave-delay", &adapt)) {
> ts->over_sample_delay = 2;
> } else {
> - if (adapt >= 2 || adapt <= LRADC_DELAY_DELAY_MASK + 1) {
> + if (adapt >= 2 && adapt <= LRADC_DELAY_DELAY_MASK + 1) {
> ts->over_sample_delay = adapt;
> } else {
> dev_err(ts->dev, "Invalid sample delay (%u)\n",
> @@ -666,7 +666,7 @@ static int mxs_lradc_ts_probe(struct platform_device *pdev)
> if (of_property_read_u32(node, "fsl,settling", &adapt)) {
> ts->settling_delay = 10;
> } else {
> - if (adapt >= 1 || adapt <= LRADC_DELAY_DELAY_MASK) {
> + if (adapt >= 1 && adapt <= LRADC_DELAY_DELAY_MASK) {
> ts->settling_delay = adapt;
> } else {
> dev_err(ts->dev, "Invalid settling delay (%u)\n",
Thanks.
--
Dmitry
next prev parent reply other threads:[~2017-04-26 21:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-26 21:04 [PATCH 2/2] input: touchscreen: mxs-lradc: || vs && typos Dan Carpenter
2017-04-26 21:12 ` Dmitry Torokhov [this message]
2017-04-27 8:03 ` Lee Jones
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=20170426211231.GA34586@dtor-ws \
--to=dmitry.torokhov@gmail.com \
--cc=dan.carpenter@oracle.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=ksenija.stanojevic@gmail.com \
--cc=lee.jones@linaro.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=marex@denx.de \
/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).