diff options
author | Aditya Pakki <pakki001@umn.edu> | 2018-12-24 11:31:13 -0600 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-01-18 16:34:06 +0100 |
commit | b05ae01fdb8966afff5b153e7a7ee24684745e2d (patch) | |
tree | 0a112aa7bf0a5255e37488886cfb4717c96afe85 /drivers/misc/ics932s401.c | |
parent | 068ad41ec565357f4c37e52d4026c896bdeaec56 (diff) | |
download | linux-b05ae01fdb8966afff5b153e7a7ee24684745e2d.tar.gz |
misc/ics932s401: Add a missing check to i2c_smbus_read_word_data
ics932s401_update_device may fail reading in i2c_smbus_read_word_data
due to error in i2c_smbus_xfer. The fix checks the status and defaults
the register to 0.
Signed-off-by: Aditya Pakki <pakki001@umn.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/ics932s401.c')
-rw-r--r-- | drivers/misc/ics932s401.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/misc/ics932s401.c b/drivers/misc/ics932s401.c index 81a0541ef3ac..294fb2f66bfe 100644 --- a/drivers/misc/ics932s401.c +++ b/drivers/misc/ics932s401.c @@ -146,6 +146,8 @@ static struct ics932s401_data *ics932s401_update_device(struct device *dev) */ for (i = 0; i < NUM_MIRRORED_REGS; i++) { temp = i2c_smbus_read_word_data(client, regs_to_copy[i]); + if (temp < 0) + data->regs[regs_to_copy[i]] = 0; data->regs[regs_to_copy[i]] = temp >> 8; } |