* [PATCH] misc/ics932s401: Add a missing check to i2c_smbus_read_word_data
@ 2018-12-24 17:31 Aditya Pakki
0 siblings, 0 replies; only message in thread
From: Aditya Pakki @ 2018-12-24 17:31 UTC (permalink / raw)
To: pakki001; +Cc: kjlu, Arnd Bergmann, Greg Kroah-Hartman, linux-kernel
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>
---
drivers/misc/ics932s401.c | 2 ++
1 file changed, 2 insertions(+)
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;
}
--
2.17.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2018-12-24 17:31 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-24 17:31 [PATCH] misc/ics932s401: Add a missing check to i2c_smbus_read_word_data Aditya Pakki
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.