Skip to contentSkip to conversation

iio: mma8452: add missed iio_device_unregister in probe failure

PATCH Superseded Chuhong Yuan 1 participant 1 message May 27, 2020 IIO

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iio: mma8452: add missed iio_device_unregister in probe failure

mma8452_probe() calls iio_device_register() but misses to call iio_device_unregister() when probe fails.
Add the missed call in error handler to fix it.

---
 drivers/iio/accel/mma8452.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/iio/accel/mma8452.c +4 -1
index 00e100fc845a..813bca7cfc3e 100644
@@ -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);
 
Signature · 1 line
2.26.2