From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Axel Lin <axel.lin@gmail.com>
Cc: linux-kernel@vger.kernel.org,
"Sreedhara Murthy. D.S" <sreedhara.ds@intel.com>,
linux-input@vger.kernel.org, Alan Cox <alan@linux.intel.com>
Subject: Re: [PATCH] Input: intel-mid-touch - remove pointless checking for variable 'found'
Date: Tue, 12 Jul 2011 23:57:37 -0700 [thread overview]
Message-ID: <20110713065737.GA4201@core.coreip.homeip.net> (raw)
In-Reply-To: <1310454831.16511.1.camel@phoenix>
On Tue, Jul 12, 2011 at 03:13:51PM +0800, Axel Lin wrote:
> The implementation does break from the for loop after we assign i to variable
> 'found'.
>
Hmm, if we are cleaning this up what about the following?
Thanks.
--
Dmitry
Input: intel-mid-touch - remove pointless checking for variable 'found'
From: Axel Lin <axel.lin@gmail.com>
The implementation does break from the for loop after we assign i to variable
'found'.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
---
drivers/input/touchscreen/intel-mid-touch.c | 15 +++++----------
1 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/drivers/input/touchscreen/intel-mid-touch.c b/drivers/input/touchscreen/intel-mid-touch.c
index 66c96bf..3276952 100644
--- a/drivers/input/touchscreen/intel-mid-touch.c
+++ b/drivers/input/touchscreen/intel-mid-touch.c
@@ -448,15 +448,11 @@ static int __devinit mrstouch_read_pmic_id(uint *vendor, uint *rev)
*/
static int __devinit mrstouch_chan_parse(struct mrstouch_dev *tsdev)
{
- int err, i, found;
+ int found = 0;
+ int err, i;
u8 r8;
- found = -1;
-
for (i = 0; i < MRSTOUCH_MAX_CHANNELS; i++) {
- if (found >= 0)
- break;
-
err = intel_scu_ipc_ioread8(PMICADDR0 + i, &r8);
if (err)
return err;
@@ -466,16 +462,15 @@ static int __devinit mrstouch_chan_parse(struct mrstouch_dev *tsdev)
break;
}
}
- if (found < 0)
- return 0;
if (tsdev->vendor == PMIC_VENDOR_FS) {
- if (found && found > (MRSTOUCH_MAX_CHANNELS - 18))
+ if (found > MRSTOUCH_MAX_CHANNELS - 18)
return -ENOSPC;
} else {
- if (found && found > (MRSTOUCH_MAX_CHANNELS - 4))
+ if (found > MRSTOUCH_MAX_CHANNELS - 4)
return -ENOSPC;
}
+
return found;
}
next prev parent reply other threads:[~2011-07-13 6:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-12 7:13 [PATCH] Input: intel-mid-touch - remove pointless checking for variable 'found' Axel Lin
2011-07-13 6:57 ` Dmitry Torokhov [this message]
2011-07-13 13:06 ` Axel Lin
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=20110713065737.GA4201@core.coreip.homeip.net \
--to=dmitry.torokhov@gmail.com \
--cc=alan@linux.intel.com \
--cc=axel.lin@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sreedhara.ds@intel.com \
/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).