diff options
author | Sami Liedes <sliedes@nvidia.com> | 2013-02-05 15:52:06 +0200 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2013-09-14 12:56:55 -0700 |
commit | 9dafe9216335cda950f215bdd4f41341b94e6a50 (patch) | |
tree | 25d61c321f40372c3c5f9557eae998fba5ccadee /drivers/hwmon | |
parent | d1dca5a6cadb40be279605f1bcce0144ef142ecb (diff) |
hwmon: ina219: Fix error case return values
In both show_power() and show_current(), an error case can cause the
value of `retval' to be returned without the variable having ever been
initialized.
Fix the error cases to return -EAGAIN.
Change-Id: I929097028ba861267a69e32d963fb225310a0ecd
Signed-off-by: Sami Liedes <sliedes@nvidia.com>
Reviewed-on: http://git-master/r/197474
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Anshul Jain (SW) <anshulj@nvidia.com>
Reviewed-by: Juha Tukkinen <jtukkinen@nvidia.com>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r-- | drivers/hwmon/ina219.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/hwmon/ina219.c b/drivers/hwmon/ina219.c index d1ca194aa9b5..b5b88dc5753c 100644 --- a/drivers/hwmon/ina219.c +++ b/drivers/hwmon/ina219.c @@ -1,7 +1,7 @@ /* * ina219.c - driver for TI INA219 current / power monitor sensor * - * Copyright (c) 2011, NVIDIA Corporation. + * Copyright (c) 2011-2013, NVIDIA Corporation. * * The INA219 is a sensor chip made by Texas Instruments. It measures * power, voltage and current on a power rail. @@ -276,8 +276,10 @@ static s32 show_power(struct device *dev, mutex_lock(&data->mutex); cur_state = data->state; if (data->state == STOPPED) { - if (power_up_INA219(client, data->pInfo->trig_conf) < 0) + if (power_up_INA219(client, data->pInfo->trig_conf) < 0) { + retval = -EAGAIN; goto error; + } } else { mutex_unlock(&data->mutex); return show_power2(dev, attr, buf); @@ -398,8 +400,10 @@ static s32 show_current(struct device *dev, cur_state = data->state; if (data->state == STOPPED) { - if (power_up_INA219(client, data->pInfo->trig_conf) < 0) + if (power_up_INA219(client, data->pInfo->trig_conf) < 0) { + retval = -EAGAIN; goto error; + } } else { mutex_unlock(&data->mutex); show_current2(dev, attr, buf); |