From: Fred Akers <knivey@botops.net>
To: greg@kroah.com, abbotti@mev.co.uk, hsweeten@visionengravers.com
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
Fred Akers <knivey@botops.net>
Subject: [PATCH v2 1/2] Staging: comedi: range: tidy up comedi_check_chanlist()
Date: Thu, 6 Mar 2014 01:57:18 -0500 [thread overview]
Message-ID: <1394089039-12408-1-git-send-email-knivey@botops.net> (raw)
In-Reply-To: <20140306062333.GA19862@kroah.com>
Refactor this function to remove an extra indent level
Signed-off-by: Fred Akers <knivey@botops.net>
---
drivers/staging/comedi/range.c | 39 +++++++++++++++++++--------------------
1 file changed, 19 insertions(+), 20 deletions(-)
diff --git a/drivers/staging/comedi/range.c b/drivers/staging/comedi/range.c
index 46b3da6..c4bb13b 100644
--- a/drivers/staging/comedi/range.c
+++ b/drivers/staging/comedi/range.c
@@ -143,29 +143,28 @@ int comedi_check_chanlist(struct comedi_subdevice *s, int n,
unsigned int chanspec;
int chan, range_len, i;
- if (s->range_table || s->range_table_list) {
- for (i = 0; i < n; i++) {
- chanspec = chanlist[i];
- chan = CR_CHAN(chanspec);
- if (s->range_table)
- range_len = s->range_table->length;
- else if (s->range_table_list && chan < s->n_chan)
- range_len = s->range_table_list[chan]->length;
- else
- range_len = 0;
- if (chan >= s->n_chan ||
- CR_RANGE(chanspec) >= range_len ||
- aref_invalid(s, chanspec)) {
- dev_warn(dev->class_dev,
- "bad chanlist[%d]=0x%08x chan=%d range length=%d\n",
- i, chanspec, chan, range_len);
- return -EINVAL;
- }
- }
- } else {
+ if (!s->range_table && !s->range_table_list) {
dev_err(dev->class_dev, "(bug) no range type list!\n");
return -EINVAL;
}
+ for (i = 0; i < n; i++) {
+ chanspec = chanlist[i];
+ chan = CR_CHAN(chanspec);
+ if (s->range_table)
+ range_len = s->range_table->length;
+ else if (s->range_table_list && chan < s->n_chan)
+ range_len = s->range_table_list[chan]->length;
+ else
+ range_len = 0;
+ if (chan >= s->n_chan ||
+ CR_RANGE(chanspec) >= range_len ||
+ aref_invalid(s, chanspec)) {
+ dev_warn(dev->class_dev,
+ "bad chanlist[%d]=0x%08x chan=%d range length=%d\n",
+ i, chanspec, chan, range_len);
+ return -EINVAL;
+ }
+ }
return 0;
}
EXPORT_SYMBOL_GPL(comedi_check_chanlist);
--
1.8.5.3
next prev parent reply other threads:[~2014-03-06 6:57 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <53176DC0.9070503@mev.co.uk>
2014-03-06 6:07 ` [PATCH] Staging: comedi: range: remove unnecessary sanity check Fred Akers
2014-03-06 6:23 ` Greg KH
2014-03-06 6:57 ` Fred Akers [this message]
2014-03-06 9:05 ` [PATCH v2 1/2] Staging: comedi: range: tidy up comedi_check_chanlist() Ian Abbott
2014-03-06 16:43 ` Hartley Sweeten
2014-03-06 6:57 ` [PATCH v2 2/2] Staging: comedi: range: remove unnecessary sanity check Fred Akers
2014-03-06 9:18 ` Ian Abbott
2014-03-06 9:24 ` Dan Carpenter
2014-03-06 16:44 ` Hartley Sweeten
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=1394089039-12408-1-git-send-email-knivey@botops.net \
--to=knivey@botops.net \
--cc=abbotti@mev.co.uk \
--cc=devel@driverdev.osuosl.org \
--cc=greg@kroah.com \
--cc=hsweeten@visionengravers.com \
--cc=linux-kernel@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
all inboxes | Powered by JetHome®