Linux IIO development
 help / color / mirror / Atom feed
From: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
To: linux-iio@vger.kernel.org
Cc: "David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Jonathan Cameron" <jonathan.cameron@oss.qualcomm.com>
Subject: [PATCH 06/22] iio: chemical: sgp30: Remove redundant i2c_master_recv() length check
Date: Wed, 15 Jul 2026 17:57:21 -0700	[thread overview]
Message-ID: <20260716005737.254577-7-jonathan.cameron@oss.qualcomm.com> (raw)
In-Reply-To: <20260716005737.254577-1-jonathan.cameron@oss.qualcomm.com>

i2c_master_recv() returns either a negative errno or exactly the count
passed in, so the length check after the 'ret < 0' test can never be
true. Drop the dead branch.

Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Assisted-by: Claude:claude-opus-4-8
---
 drivers/iio/chemical/sgp30.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/iio/chemical/sgp30.c b/drivers/iio/chemical/sgp30.c
index f10bbebc29e4..8152606c6495 100644
--- a/drivers/iio/chemical/sgp30.c
+++ b/drivers/iio/chemical/sgp30.c
@@ -254,8 +254,6 @@ static int sgp_read_cmd(struct sgp_data *data, enum sgp_cmd cmd,
 	ret = i2c_master_recv(client, data_buf, size);
 	if (ret < 0)
 		return ret;
-	if (ret != size)
-		return -EIO;
 
 	return sgp_verify_buffer(data, buf, word_count);
 }
-- 
2.43.0


  parent reply	other threads:[~2026-07-16  0:57 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-16  0:57 [RESEND PATCH 00/22] IIO: Clean out superfluous I2C checks for single transfers Jonathan Cameron
2026-07-16  0:57 ` [PATCH 01/22] iio: adc: ltc2471: Remove redundant i2c_master_recv() length check Jonathan Cameron
2026-07-16  0:57 ` [PATCH 02/22] iio: adc: ti-ads7138: Remove redundant i2c_master_send() length checks Jonathan Cameron
2026-07-16  0:57 ` [PATCH 03/22] iio: adc: versal-sysmon: Remove redundant i2c_master_{send,recv}() " Jonathan Cameron
2026-07-16  0:57 ` [PATCH 04/22] iio: chemical: scd30: " Jonathan Cameron
2026-07-16 15:30   ` Maxwell Doose
2026-07-16  0:57 ` [PATCH 05/22] iio: chemical: scd4x: " Jonathan Cameron
2026-07-16  0:57 ` Jonathan Cameron [this message]
2026-07-16  0:57 ` [PATCH 07/22] iio: chemical: sgp40: Remove redundant i2c_master_recv() length check Jonathan Cameron
2026-07-16  0:57 ` [PATCH 08/22] iio: chemical: sps30: Remove redundant i2c_master_{send,recv}() length checks Jonathan Cameron
2026-07-16  0:57 ` [PATCH 09/22] iio: dac: ad5446: Remove redundant i2c_master_send() length check Jonathan Cameron
2026-07-16  0:57 ` [PATCH 10/22] iio: dac: ad5696: " Jonathan Cameron
2026-07-16  0:57 ` [PATCH 11/22] iio: dac: m62332: " Jonathan Cameron
2026-07-16  0:57 ` [PATCH 12/22] iio: dac: max517: " Jonathan Cameron
2026-07-16  7:45   ` Joshua Crofts
2026-07-16  0:57 ` [PATCH 13/22] iio: dac: max5821: Remove redundant i2c_master_{send,recv}() length checks Jonathan Cameron
2026-07-16  0:57 ` [PATCH 14/22] iio: dac: mcp4725: " Jonathan Cameron
2026-07-16  0:57 ` [PATCH 15/22] iio: dac: mcp4728: " Jonathan Cameron
2026-07-16  0:57 ` [PATCH 16/22] iio: light: lv0104cs: " Jonathan Cameron
2026-07-16  0:57 ` [PATCH 17/22] iio: potentiometer: ad5110: " Jonathan Cameron
2026-07-16  0:57 ` [PATCH 18/22] iio: pressure: abp2030pa: " Jonathan Cameron
2026-07-16  0:57 ` [PATCH 19/22] iio: pressure: adp810: " Jonathan Cameron
2026-07-16  0:57 ` [PATCH 20/22] iio: pressure: icp10100: Remove redundant i2c_master_send() length check Jonathan Cameron
2026-07-16  0:57 ` [PATCH 21/22] iio: pressure: mprls0025pa: Remove redundant i2c_master_{send,recv}() length checks Jonathan Cameron
2026-07-16  0:57 ` [PATCH 22/22] iio: pressure: sdp500: Remove redundant i2c_master_recv() length check Jonathan Cameron
2026-07-16  8:01 ` [RESEND PATCH 00/22] IIO: Clean out superfluous I2C checks for single transfers Joshua Crofts
2026-07-16 10:15 ` Nuno Sá
2026-07-16 14:55 ` Lars-Peter Clausen

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=20260716005737.254577-7-jonathan.cameron@oss.qualcomm.com \
    --to=jonathan.cameron@oss.qualcomm.com \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=nuno.sa@analog.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