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 03/22] iio: adc: versal-sysmon: Remove redundant i2c_master_{send,recv}() length checks
Date: Wed, 15 Jul 2026 17:57:18 -0700 [thread overview]
Message-ID: <20260716005737.254577-4-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/adc/versal-sysmon-i2c.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/drivers/iio/adc/versal-sysmon-i2c.c b/drivers/iio/adc/versal-sysmon-i2c.c
index e9a7629159ab..afdcc4e93771 100644
--- a/drivers/iio/adc/versal-sysmon-i2c.c
+++ b/drivers/iio/adc/versal-sysmon-i2c.c
@@ -44,14 +44,10 @@ static int sysmon_i2c_reg_read(void *context, unsigned int reg,
ret = i2c_master_send(client, write_buf, sizeof(write_buf));
if (ret < 0)
return ret;
- if (ret != sizeof(write_buf))
- return -EIO;
ret = i2c_master_recv(client, read_buf, sizeof(read_buf));
if (ret < 0)
return ret;
- if (ret != sizeof(read_buf))
- return -EIO;
*val = get_unaligned_le32(read_buf);
@@ -72,8 +68,6 @@ static int sysmon_i2c_reg_write(void *context, unsigned int reg,
ret = i2c_master_send(client, write_buf, sizeof(write_buf));
if (ret < 0)
return ret;
- if (ret != sizeof(write_buf))
- return -EIO;
return 0;
}
--
2.43.0
next prev 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 ` Jonathan Cameron [this message]
2026-07-16 0:57 ` [PATCH 04/22] iio: chemical: scd30: Remove redundant i2c_master_{send,recv}() " 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 ` [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 ` [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-4-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.