Skip to content

Commit

Permalink
iio: mma8452: Add missed iio_device_unregister() call in mma8452_probe()
Browse files Browse the repository at this point in the history
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 <hslester96@gmail.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
  • Loading branch information
Chuhong Yuan authored and Jonathan Cameron committed Jun 14, 2020
1 parent f88eccc commit d7369ae
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/iio/accel/mma8452.c
Original file line number Diff line number Diff line change
Expand Up @@ -1685,10 +1685,13 @@ static int mma8452_probe(struct i2c_client *client,

ret = mma8452_set_freefall_mode(data, false);
if (ret < 0)
goto buffer_cleanup;
goto unregister_device;

return 0;

unregister_device:
iio_device_unregister(indio_dev);

buffer_cleanup:
iio_triggered_buffer_cleanup(indio_dev);

Expand Down

0 comments on commit d7369ae

Please sign in to comment.