diff options
author | Irina Tirdea <irina.tirdea@intel.com> | 2015-04-13 18:40:54 +0300 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2015-04-26 19:46:39 +0100 |
commit | 1d052931c689d14397d05ac705cf386955bcf813 (patch) | |
tree | 8662c1298ede068b0b99e8d31ce1491fccce16f9 /drivers/iio/accel | |
parent | 476c41a73eee708101495d2202c82060d0fc787d (diff) | |
download | linux-1d052931c689d14397d05ac705cf386955bcf813.tar.bz2 |
iio: accel: mma9553: check for error in reading initial activity and stepcnt
When configuring gpio, we need to read initial values for activity and
step count. This function may fail due to i2c read errors.
Check the error code returned by mma9553_read_activity_stepcnt
and return the appropriate error in gpio config function.
Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Reported-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/accel')
-rw-r--r-- | drivers/iio/accel/mma9553.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/iio/accel/mma9553.c b/drivers/iio/accel/mma9553.c index 2df1af7d43fc..04a4bb99b269 100644 --- a/drivers/iio/accel/mma9553.c +++ b/drivers/iio/accel/mma9553.c @@ -365,9 +365,12 @@ static int mma9553_conf_gpio(struct mma9553_data *data) return 0; /* Save initial values for activity and stepcnt */ - if (activity_enabled || ev_step_detect->enabled) - mma9553_read_activity_stepcnt(data, &data->activity, - &data->stepcnt); + if (activity_enabled || ev_step_detect->enabled) { + ret = mma9553_read_activity_stepcnt(data, &data->activity, + &data->stepcnt); + if (ret < 0) + return ret; + } ret = mma9551_gpio_config(data->client, MMA9553_DEFAULT_GPIO_PIN, |