All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Cercueil <paul@crapouillou.net>
To: Jonathan Cameron <jic23@kernel.org>, Peter Rosin <peda@axentia.se>
Cc: Lars-Peter Clausen <lars@metafoo.de>,
	list@opendingux.net, linux-iio@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Paul Cercueil <paul@crapouillou.net>
Subject: [PATCH 1/4] iio: inkern: Remove useless argument to iio_channel_read_max()
Date: Thu, 21 Jul 2022 20:15:23 +0100	[thread overview]
Message-ID: <20220721191526.374152-2-paul@crapouillou.net> (raw)
In-Reply-To: <20220721191526.374152-1-paul@crapouillou.net>

The 'type' argument was passed by the only caller of the
iio_channel_read_max() function as a pointer to return an extra value,
but the value of the variable passed by the caller was never read
afterwards.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 drivers/iio/inkern.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c
index df74765d33dc..e8a25852f0df 100644
--- a/drivers/iio/inkern.c
+++ b/drivers/iio/inkern.c
@@ -813,21 +813,22 @@ int iio_read_avail_channel_raw(struct iio_channel *chan,
 EXPORT_SYMBOL_GPL(iio_read_avail_channel_raw);
 
 static int iio_channel_read_max(struct iio_channel *chan,
-				int *val, int *val2, int *type,
+				int *val, int *val2,
 				enum iio_chan_info_enum info)
 {
 	int unused;
 	const int *vals;
 	int length;
 	int ret;
+	int type;
 
 	if (!val2)
 		val2 = &unused;
 
-	ret = iio_channel_read_avail(chan, &vals, type, &length, info);
+	ret = iio_channel_read_avail(chan, &vals, &type, &length, info);
 	switch (ret) {
 	case IIO_AVAIL_RANGE:
-		switch (*type) {
+		switch (type) {
 		case IIO_VAL_INT:
 			*val = vals[2];
 			break;
@@ -840,7 +841,7 @@ static int iio_channel_read_max(struct iio_channel *chan,
 	case IIO_AVAIL_LIST:
 		if (length <= 0)
 			return -EINVAL;
-		switch (*type) {
+		switch (type) {
 		case IIO_VAL_INT:
 			*val = vals[--length];
 			while (length) {
@@ -863,7 +864,6 @@ int iio_read_max_channel_raw(struct iio_channel *chan, int *val)
 {
 	struct iio_dev_opaque *iio_dev_opaque = to_iio_dev_opaque(chan->indio_dev);
 	int ret;
-	int type;
 
 	mutex_lock(&iio_dev_opaque->info_exist_lock);
 	if (!chan->indio_dev->info) {
@@ -871,7 +871,7 @@ int iio_read_max_channel_raw(struct iio_channel *chan, int *val)
 		goto err_unlock;
 	}
 
-	ret = iio_channel_read_max(chan, val, NULL, &type, IIO_CHAN_INFO_RAW);
+	ret = iio_channel_read_max(chan, val, NULL, IIO_CHAN_INFO_RAW);
 err_unlock:
 	mutex_unlock(&iio_dev_opaque->info_exist_lock);
 
-- 
2.35.1


  reply	other threads:[~2022-07-21 19:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-21 19:15 [PATCH 0/4] iio: afe/rescale improvements Paul Cercueil
2022-07-21 19:15 ` Paul Cercueil [this message]
2022-07-31 17:07   ` [PATCH 1/4] iio: inkern: Remove useless argument to iio_channel_read_max() Jonathan Cameron
2022-07-21 19:15 ` [PATCH 2/4] iio: core: Add support for IIO_AVAIL_LIST_WITH_TYPE Paul Cercueil
2022-07-31 17:22   ` Jonathan Cameron
2022-07-21 19:15 ` [PATCH 3/4] iio: afe/rescale: Add support for converting scale avail table Paul Cercueil
2022-07-21 22:16   ` Peter Rosin
2022-07-22  8:52     ` Paul Cercueil
2022-07-31 16:58       ` Jonathan Cameron
2022-07-21 19:15 ` [PATCH 4/4] iio: afe/rescale: Implement write_raw Paul Cercueil
2022-07-21 22:16   ` Peter Rosin
2022-07-22  9:33     ` Paul Cercueil

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=20220721191526.374152-2-paul@crapouillou.net \
    --to=paul@crapouillou.net \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=list@opendingux.net \
    --cc=peda@axentia.se \
    /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.