Skip to content

Commit 1a965d4

Browse files
bijoshjic23
authored andcommitted
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>
1 parent 21d4165 commit 1a965d4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/iio/accel/mma8452.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1579,8 +1579,8 @@ static int mma8452_probe(struct i2c_client *client,
15791579
goto buffer_cleanup;
15801580

15811581
ret = mma8452_set_freefall_mode(data, false);
1582-
if (ret)
1583-
return ret;
1582+
if (ret < 0)
1583+
goto buffer_cleanup;
15841584

15851585
return 0;
15861586

0 commit comments

Comments
 (0)