From: Bijosh Thykkoottathil Date: Mon, 4 Jul 2016 10:08:53 +0000 (+0000) Subject: drivers:iio:accel:mma8452: added cleanup provision in case of failure. X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=1a965d405fc6f6b1e3454baad7001fed91c9c458;p=deliverable%2Flinux.git 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 Acked-by: Martin Kepplinger Signed-off-by: Jonathan Cameron --- 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, goto buffer_cleanup; ret = mma8452_set_freefall_mode(data, false); - if (ret) - return ret; + if (ret < 0) + goto buffer_cleanup; return 0;