All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Ksenija Stanojevic <ksenija.stanojevic@gmail.com>
Cc: 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: [PATCH 2/2] input: touchscreen: mxs-lradc: || vs && typos
Date: Wed, 26 Apr 2017 21:04:31 +0000	[thread overview]
Message-ID: <20170426210431.mqze5ehrijm7l2ey@mwanda> (raw)

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>

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",

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Ksenija Stanojevic <ksenija.stanojevic@gmail.com>
Cc: 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: [PATCH 2/2] input: touchscreen: mxs-lradc: || vs && typos
Date: Thu, 27 Apr 2017 00:04:31 +0300	[thread overview]
Message-ID: <20170426210431.mqze5ehrijm7l2ey@mwanda> (raw)

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>

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",

             reply	other threads:[~2017-04-26 21:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-26 21:04 Dan Carpenter [this message]
2017-04-26 21:04 ` [PATCH 2/2] input: touchscreen: mxs-lradc: || vs && typos Dan Carpenter
2017-04-26 21:12 ` Dmitry Torokhov
2017-04-26 21:12   ` Dmitry Torokhov
2017-04-27  8:03 ` Lee Jones
2017-04-27  8:03   ` Lee Jones
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=20170426210431.mqze5ehrijm7l2ey@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=dmitry.torokhov@gmail.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 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.