Skip to content

Commit d7369ae

Browse files
WillLesterjic23
authored andcommitted
iio: mma8452: Add missed iio_device_unregister() call in mma8452_probe()
The function iio_device_register() was called in mma8452_probe(). But the function iio_device_unregister() was not called after a call of the function mma8452_set_freefall_mode() failed. Thus add the missed function call for one error case. Fixes: 1a965d4 ("drivers:iio:accel:mma8452: added cleanup provision in case of failure.") Signed-off-by: Chuhong Yuan <[email protected]> Cc: <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
1 parent f88eccc commit d7369ae

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/iio/accel/mma8452.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1685,10 +1685,13 @@ static int mma8452_probe(struct i2c_client *client,
16851685

16861686
ret = mma8452_set_freefall_mode(data, false);
16871687
if (ret < 0)
1688-
goto buffer_cleanup;
1688+
goto unregister_device;
16891689

16901690
return 0;
16911691

1692+
unregister_device:
1693+
iio_device_unregister(indio_dev);
1694+
16921695
buffer_cleanup:
16931696
iio_triggered_buffer_cleanup(indio_dev);
16941697

0 commit comments

Comments
 (0)