]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
drivers:iio:accel:mma8452: added cleanup provision in case of failure.
authorBijosh Thykkoottathil <bijosh.t@hotmail.com>
Mon, 4 Jul 2016 10:08:53 +0000 (10:08 +0000)
committerJonathan Cameron <jic23@kernel.org>
Tue, 5 Jul 2016 20:03:40 +0000 (21:03 +0100)
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>
drivers/iio/accel/mma8452.c

index c0df2832836859441e68aeccac02e5500a603494..9ba2f7f0d9428666c07d5b891e816d87f4db4425 100644 (file)
@@ -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;