diff options
author | Bo Kim <bok@nvidia.com> | 2013-06-20 18:30:53 +0900 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2013-09-14 13:31:08 -0700 |
commit | 3d50383690fbb91fd3a5e1118376ebb99080be5a (patch) | |
tree | 3aab8c0d208767df1f2b8ce118afe93245e6c14b /drivers/hwmon | |
parent | 970bac10a2e86f5b98ca3b916b31c03433d65040 (diff) |
hwmon: ina230: add type casting for negative current
When precision_multiplier has positive value and current has negative
value, the calculation makes wrong result by implicit type casting.
Bug 1311630
Change-Id: I272783d1e081059a296a1cce33f660cfb1fcd52b
Signed-off-by: Bo Kim <bok@nvidia.com>
Reviewed-on: http://git-master/r/245046
(cherry picked from commit a62ae4ba0b076ee2349ff3503656e8d9812c0e72)
Reviewed-on: http://git-master/r/248236
Reviewed-by: Hyong Bin Kim <hyongbink@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r-- | drivers/hwmon/ina230.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/hwmon/ina230.c b/drivers/hwmon/ina230.c index e9db50fa6674..93592b090fe4 100644 --- a/drivers/hwmon/ina230.c +++ b/drivers/hwmon/ina230.c @@ -460,7 +460,7 @@ static s32 show_current(struct device *dev, current_mA = (current_mA * data->pdata->power_lsb) / data->pdata->divisor; if (data->pdata->precision_multiplier) - current_mA /= data->pdata->precision_multiplier; + current_mA /= (s16) data->pdata->precision_multiplier; return sprintf(buf, "%d mA\n", current_mA); } |