diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c index 39c1d635dc03..fe30bcb6a57b 100644 --- a/drivers/iio/inkern.c +++ b/drivers/iio/inkern.c @@ -60,6 +60,8 @@ int iio_map_array_register(struct iio_dev *indio_dev, struct iio_map *maps) i++; } error_ret: + if (ret) + iio_map_array_unregister_locked(indio_dev); mutex_unlock(&iio_map_list_lock); return ret;