diff options
author | Bijosh Thykkoottathil <bijosh.t@hotmail.com> | 2016-07-04 06:08:53 -0400 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2016-07-05 16:03:40 -0400 |
commit | 1a965d405fc6f6b1e3454baad7001fed91c9c458 (patch) | |
tree | 424e4da80d90e8f2d6d3e6efd2759ea4309d7b59 | |
parent | 21d41655f5dde155caa2e5c004ac45bb76291449 (diff) |
drivers:iio:accel:mma8452: added cleanup provision in case of failure.
mma8452_set_freefall_mode can return -ve value in case if
i2c_smbus_read_byte_data fails. This function is called from mma8452_probe,
and returning -ve value from probe indicates probe failure. Need to call
iio_triggered_buffer_cleanup & iio_trigger_cleanup in this case.
Signed-off-by: Bijosh Thykkoottathil <bijosh.t@hotmail.com>
Acked-by: Martin Kepplinger <martink@posteo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
-rw-r--r-- | drivers/iio/accel/mma8452.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c index c0df28328368..9ba2f7f0d942 100644 --- a/drivers/iio/accel/mma8452.c +++ b/drivers/iio/accel/mma8452.c | |||
@@ -1579,8 +1579,8 @@ static int mma8452_probe(struct i2c_client *client, | |||
1579 | goto buffer_cleanup; | 1579 | goto buffer_cleanup; |
1580 | 1580 | ||
1581 | ret = mma8452_set_freefall_mode(data, false); | 1581 | ret = mma8452_set_freefall_mode(data, false); |
1582 | if (ret) | 1582 | if (ret < 0) |
1583 | return ret; | 1583 | goto buffer_cleanup; |
1584 | 1584 | ||
1585 | return 0; | 1585 | return 0; |
1586 | 1586 | ||