From: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
To: Jonathan Cameron <jic23@kernel.org>
Cc: linux-iio@vger.kernel.org, lars@metafoo.de, knaack.h@gmx.de,
Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Subject: [PATCH 3/4] iio: light: vcnl4000: Cleanup read_raw() returns
Date: Tue, 5 Jul 2016 12:23:20 +0200 [thread overview]
Message-ID: <1467714201-11429-4-git-send-email-pmeerw@pmeerw.net> (raw)
In-Reply-To: <1467714201-11429-1-git-send-email-pmeerw@pmeerw.net>
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
---
drivers/iio/light/vcnl4000.c | 27 +++++++++++----------------
1 file changed, 11 insertions(+), 16 deletions(-)
diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c
index 7f247ed..9f94b6b 100644
--- a/drivers/iio/light/vcnl4000.c
+++ b/drivers/iio/light/vcnl4000.c
@@ -109,7 +109,7 @@ static int vcnl4000_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int *val, int *val2, long mask)
{
- int ret = -EINVAL;
+ int ret;
struct vcnl4000_data *data = iio_priv(indio_dev);
switch (mask) {
@@ -121,32 +121,27 @@ static int vcnl4000_read_raw(struct iio_dev *indio_dev,
VCNL4000_AL_RESULT_HI, val);
if (ret < 0)
return ret;
- ret = IIO_VAL_INT;
- break;
+ return IIO_VAL_INT;
case IIO_PROXIMITY:
ret = vcnl4000_measure(data,
VCNL4000_PS_OD, VCNL4000_PS_RDY,
VCNL4000_PS_RESULT_HI, val);
if (ret < 0)
return ret;
- ret = IIO_VAL_INT;
- break;
+ return IIO_VAL_INT;
default:
- break;
+ return -EINVAL;
}
- break;
case IIO_CHAN_INFO_SCALE:
- if (chan->type == IIO_LIGHT) {
- *val = 0;
- *val2 = 250000;
- ret = IIO_VAL_INT_PLUS_MICRO;
- }
- break;
+ if (chan->type != IIO_LIGHT)
+ return -EINVAL;
+
+ *val = 0;
+ *val2 = 250000;
+ return IIO_VAL_INT_PLUS_MICRO;
default:
- break;
+ return -EINVAL;
}
-
- return ret;
}
static const struct iio_info vcnl4000_info = {
--
1.7.10.4
next prev parent reply other threads:[~2016-07-05 10:23 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-05 10:23 [PATCH 0/4] iio: light: vcnl4000: cleanup and fixes Peter Meerwald-Stadler
2016-07-05 10:23 ` [PATCH 1/4] iio: light: vcnl4000: Mention and check support for VCNL4010 and VCNL4020 Peter Meerwald-Stadler
2016-07-10 13:29 ` Jonathan Cameron
2016-07-05 10:23 ` [PATCH 2/4] iio: light: vcnl4000: Use BIT() macro Peter Meerwald-Stadler
2016-07-10 13:31 ` Jonathan Cameron
2016-07-05 10:23 ` Peter Meerwald-Stadler [this message]
2016-07-10 13:32 ` [PATCH 3/4] iio: light: vcnl4000: Cleanup read_raw() returns Jonathan Cameron
2016-07-05 10:23 ` [PATCH 4/4] iio: light: vcnl4000: Add missing locking Peter Meerwald-Stadler
2016-07-10 13:34 ` Jonathan Cameron
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=1467714201-11429-4-git-send-email-pmeerw@pmeerw.net \
--to=pmeerw@pmeerw.net \
--cc=jic23@kernel.org \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@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).