[coreboot-gerrit] New patch to review for coreboot: 1c63cdc drivers/i2c/w83795: Fix tautology from wrong return type

Edward O'Callaghan (eocallaghan@alterapraxis.com) gerrit at coreboot.org
Tue Jan 13 16:24:09 CET 2015


Edward O'Callaghan (eocallaghan at alterapraxis.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/8209

-gerrit

commit 1c63cdc4df6f7fd8f6b66d0397b026ce3bb49563
Author: Edward O'Callaghan <eocallaghan at alterapraxis.com>
Date:   Wed Jan 14 02:14:21 2015 +1100

    drivers/i2c/w83795: Fix tautology from wrong return type
    
    The correct type-signature of 'do_smbus_write_byte' is:
    
     int do_smbus_write_byte(u32 smbus_io_base, u32 device, u32 address, u8 val)
    
    and so storing the return type in a 'u32' is inappropriate, leading
    to a tautological compare of 'ret < 0' and 'err < 0'.
    
    Change-Id: I65486df7156c70af84fa00c336142d9a45998620
    Signed-off-by: Edward O'Callaghan <eocallaghan at alterapraxis.com>
---
 src/drivers/i2c/w83795/w83795.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/drivers/i2c/w83795/w83795.c b/src/drivers/i2c/w83795/w83795.c
index 569fe5a..397c22c 100644
--- a/src/drivers/i2c/w83795/w83795.c
+++ b/src/drivers/i2c/w83795/w83795.c
@@ -24,14 +24,14 @@
 #include "southbridge/amd/cimx/sb700/smbus.h" /*SMBUS_IO_BASE*/
 #include "w83795.h"
 
-static u32 w83795_set_bank(u8 bank)
+static int w83795_set_bank(u8 bank)
 {
 	return do_smbus_write_byte(SMBUS_IO_BASE, W83795_DEV, W83795_REG_BANKSEL, bank);
 }
 
 static u8 w83795_read(u16 reg)
 {
-	u32 ret;
+	int ret;
 
 	ret = w83795_set_bank(reg >> 8);
 	if (ret < 0) {
@@ -45,7 +45,7 @@ static u8 w83795_read(u16 reg)
 
 static u8 w83795_write(u16 reg, u8 value)
 {
-	u32 err;
+	int err;
 
 	err = w83795_set_bank(reg >> 8);
 	if (err < 0) {



More information about the coreboot-gerrit mailing list