summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCurt Brune <curt@cumulusnetworks.com>2013-08-08 12:11:03 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-08-14 22:55:16 -0700
commit2e18e5161c634aa5d7e685f348aca98d295accb8 (patch)
tree84a2ac1f3cefe7d11a19813f37fbcc5a08cd37bf
parent91e9a7da140b336243338476341e9980d128ab72 (diff)
downloadkernel-common-2e18e5161c634aa5d7e685f348aca98d295accb8.tar.gz
kernel-common-2e18e5161c634aa5d7e685f348aca98d295accb8.tar.bz2
kernel-common-2e18e5161c634aa5d7e685f348aca98d295accb8.zip
hwmon: (adt7470) Fix incorrect return code check
commit 93d783bcca69bfacc8dc739d8a050498402587b5 upstream. In adt7470_write_word_data(), which writes two bytes using i2c_smbus_write_byte_data(), the return codes are incorrectly AND-ed together when they should be OR-ed together. The return code of i2c_smbus_write_byte_data() is zero for success. The upshot is only the first byte was ever written to the hardware. The 2nd byte was never written out. I noticed that trying to set the fan speed limits was not working correctly on my system. Setting the fan speed limits is the only code that uses adt7470_write_word_data(). After making the change the limit settings work and the alarms work also. Signed-off-by: Curt Brune <curt@cumulusnetworks.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/hwmon/adt7470.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/hwmon/adt7470.c b/drivers/hwmon/adt7470.c
index c6d1ce059aea..a9726c18d162 100644
--- a/drivers/hwmon/adt7470.c
+++ b/drivers/hwmon/adt7470.c
@@ -215,7 +215,7 @@ static inline int adt7470_write_word_data(struct i2c_client *client, u8 reg,
u16 value)
{
return i2c_smbus_write_byte_data(client, reg, value & 0xFF)
- && i2c_smbus_write_byte_data(client, reg + 1, value >> 8);
+ || i2c_smbus_write_byte_data(client, reg + 1, value >> 8);
}
static void adt7470_init_client(struct i2c_client *client)