diff options
author | Xin Xie <xxie@nvidia.com> | 2013-08-07 10:57:22 -0700 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2013-09-14 13:41:30 -0700 |
commit | 23ce48497c3f2098b72c6bbb05b2d095475c995e (patch) | |
tree | 8c104131a6b5f320805318205c9159e934444a75 /drivers/hwmon | |
parent | 67f571d4fa9490d7512a483f0846cab74a2a8f35 (diff) |
hwmon: ina230: fix overflow in current limit
bug 258076
Change-Id: I321677861aeddd3f14c46ae99b922a3f407ed6d1
Signed-off-by: Xin Xie <xxie@nvidia.com>
Reviewed-on: http://git-master/r/259281
Reviewed-by: Venkata (Muni) Anda <vanda@nvidia.com>
GVS: Gerrit_Virtual_Submit
Diffstat (limited to 'drivers/hwmon')
-rw-r--r-- | drivers/hwmon/ina230.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/hwmon/ina230.c b/drivers/hwmon/ina230.c index a1fcaaabc564..373a4062ef11 100644 --- a/drivers/hwmon/ina230.c +++ b/drivers/hwmon/ina230.c @@ -188,7 +188,7 @@ static s32 power_down_ina230(struct i2c_client *client) static s32 __locked_start_current_mon(struct i2c_client *client) { s32 retval; - s16 shunt_uV; + s32 shunt_uV; s16 shunt_limit; s16 alert_mask; struct ina230_data *data = i2c_get_clientdata(client); @@ -210,7 +210,7 @@ static s32 __locked_start_current_mon(struct i2c_client *client) if (data->pdata->shunt_polarity_inverted) shunt_uV *= -1; - shunt_limit = uv_to_alert_register(shunt_uV); + shunt_limit = (s16) uv_to_alert_register(shunt_uV); retval = i2c_smbus_write_word_data(client, INA230_ALERT, cpu_to_be16(shunt_limit)); |