All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Guido Günther" <agx@sigxcpu.org>
To: "Tomas Novotny" <tomas@novotny.cz>,
	"Jonathan Cameron" <jic23@kernel.org>,
	"Hartmut Knaack" <knaack.h@gmx.de>,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"Peter Meerwald-Stadler" <pmeerw@pmeerw.net>,
	"Angus Ainslie (Purism)" <angus@akkea.ca>,
	"Guido Günther" <agx@sigxcpu.org>,
	"Marco Felsch" <m.felsch@pengutronix.de>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] iio: vcnl4000: Use a single return when getting IIO_CHAN_INFO_RAW
Date: Mon, 20 Jan 2020 16:01:23 +0100	[thread overview]
Message-ID: <8ed27a3935cd0e5324bd397a33dfa429b4746719.1579531608.git.agx@sigxcpu.org> (raw)
In-Reply-To: <cover.1579531608.git.agx@sigxcpu.org>

This will be useful when introducing runtime pm.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
---
 drivers/iio/light/vcnl4000.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c
index b0e241aaefb4..8f198383626b 100644
--- a/drivers/iio/light/vcnl4000.c
+++ b/drivers/iio/light/vcnl4000.c
@@ -335,17 +335,18 @@ static int vcnl4000_read_raw(struct iio_dev *indio_dev,
 		switch (chan->type) {
 		case IIO_LIGHT:
 			ret = data->chip_spec->measure_light(data, val);
-			if (ret < 0)
-				return ret;
-			return IIO_VAL_INT;
+			if (!ret)
+				ret = IIO_VAL_INT;
+			break;
 		case IIO_PROXIMITY:
 			ret = data->chip_spec->measure_proximity(data, val);
-			if (ret < 0)
-				return ret;
-			return IIO_VAL_INT;
+			if (!ret)
+				ret = IIO_VAL_INT;
+			break;
 		default:
-			return -EINVAL;
+			ret = -EINVAL;
 		}
+		return ret;
 	case IIO_CHAN_INFO_SCALE:
 		if (chan->type != IIO_LIGHT)
 			return -EINVAL;
-- 
2.23.0


  reply	other threads:[~2020-01-20 15:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-20 15:01 [PATCH 0/2] iio: vncl4000: Enable runtime pm for vcnl4200/4040 Guido Günther
2020-01-20 15:01 ` Guido Günther [this message]
2020-01-20 15:01 ` [PATCH 2/2] " Guido Günther
2020-01-20 17:28   ` Tomas Novotny
2020-01-30 13:45     ` Guido Günther

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=8ed27a3935cd0e5324bd397a33dfa429b4746719.1579531608.git.agx@sigxcpu.org \
    --to=agx@sigxcpu.org \
    --cc=angus@akkea.ca \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.felsch@pengutronix.de \
    --cc=pmeerw@pmeerw.net \
    --cc=tglx@linutronix.de \
    --cc=tomas@novotny.cz \
    /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.