[PATCH 4/7] i2cdump: Remove dead code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Considering that we exit immediately if an error happens during a
block read, the code filling the remaining bytes with -1 so that
they will be displayed as "XX" is effectively dead code, so let's
remove it.

We might want to revisit the whole logic later, as there's in fact
little reason why block read errors would be fatal when all other
read errors are not. But I'd rather remove SMBus block support from
the tool before attempting to clean up the code.

Fixes: 7abc52d7792e ("Return the correct error code on I2C block read failure.")
Signed-off-by: Jean Delvare <jdelvare@xxxxxxx>
---
 tools/i2cdump.c |    3 ---
 1 file changed, 3 deletions(-)

--- i2c-tools.orig/tools/i2cdump.c	2021-06-08 14:35:45.372892494 +0200
+++ i2c-tools/tools/i2cdump.c	2021-06-08 14:35:52.271986056 +0200
@@ -360,9 +360,6 @@ int main(int argc, char *argv[])
 				res = 256;
 			for (i = 0; i < res; i++)
 				block[i] = cblock[i];
-			if (size != I2C_SMBUS_BLOCK_DATA)
-				for (i = res; i < 256; i++)
-					block[i] = -1;
 		}
 
 		if (size == I2C_SMBUS_BYTE) {

-- 
Jean Delvare
SUSE L3 Support



[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux