Commit 1d052931 authored by Irina Tirdea's avatar Irina Tirdea Committed by Jonathan Cameron

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: default avatarIrina Tirdea <irina.tirdea@intel.com>
Reported-by: default avatarHartmut Knaack <knaack.h@gmx.de>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent 476c41a7
...@@ -365,9 +365,12 @@ static int mma9553_conf_gpio(struct mma9553_data *data) ...@@ -365,9 +365,12 @@ static int mma9553_conf_gpio(struct mma9553_data *data)
return 0; return 0;
/* Save initial values for activity and stepcnt */ /* Save initial values for activity and stepcnt */
if (activity_enabled || ev_step_detect->enabled) if (activity_enabled || ev_step_detect->enabled) {
mma9553_read_activity_stepcnt(data, &data->activity, ret = mma9553_read_activity_stepcnt(data, &data->activity,
&data->stepcnt); &data->stepcnt);
if (ret < 0)
return ret;
}
ret = mma9551_gpio_config(data->client, ret = mma9551_gpio_config(data->client,
MMA9553_DEFAULT_GPIO_PIN, MMA9553_DEFAULT_GPIO_PIN,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment