All of lore.kernel.org
 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 08/22] iio: chemical: sps30: Remove redundant i2c_master_{send,recv}() length checks
Date: Wed, 15 Jul 2026 17:57:23 -0700	[thread overview]
Message-ID: <20260716005737.254577-9-jonathan.cameron@oss.qualcomm.com> (raw)
In-Reply-To: <20260716005737.254577-1-jonathan.cameron@oss.qualcomm.com>

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

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

diff --git a/drivers/iio/chemical/sps30_i2c.c b/drivers/iio/chemical/sps30_i2c.c
index 2d3a876cc06e..284b10ef63e9 100644
--- a/drivers/iio/chemical/sps30_i2c.c
+++ b/drivers/iio/chemical/sps30_i2c.c
@@ -46,8 +46,6 @@ static int sps30_i2c_xfer(struct sps30_state *state, unsigned char *txbuf, size_
 	ret = i2c_master_send(client, txbuf, txsize);
 	if (ret < 0)
 		return ret;
-	if (ret != txsize)
-		return -EIO;
 
 	if (!rxsize)
 		return 0;
@@ -55,8 +53,6 @@ static int sps30_i2c_xfer(struct sps30_state *state, unsigned char *txbuf, size_
 	ret = i2c_master_recv(client, rxbuf, rxsize);
 	if (ret < 0)
 		return ret;
-	if (ret != rxsize)
-		return -EIO;
 
 	return 0;
 }
-- 
2.43.0


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

Thread overview: 26+ 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  0:57 ` [PATCH 05/22] iio: chemical: scd4x: " Jonathan Cameron
2026-07-16  0:57 ` [PATCH 06/22] iio: chemical: sgp30: Remove redundant i2c_master_recv() length check Jonathan Cameron
2026-07-16  0:57 ` [PATCH 07/22] iio: chemical: sgp40: " Jonathan Cameron
2026-07-16  0:57 ` Jonathan Cameron [this message]
2026-07-16  0:57 ` [PATCH 09/22] iio: dac: ad5446: Remove redundant i2c_master_send() " 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á

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-9-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 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.