io:core: In iio_map_array_register() cleanup in case of error

In function iio_map_array_register() properly rewind in case of error.

Signed-off-by: Lino Sanfilippo <LinoSanfilippo@gmx.de>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/1606571059-13974-2-git-send-email-LinoSanfilippo@gmx.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
Lino Sanfilippo 2020-11-28 14:44:19 +01:00 committed by Jonathan Cameron
parent cc9fb60eaf
commit 34fce6cadf
1 changed files with 2 additions and 0 deletions

View File

@ -60,6 +60,8 @@ int iio_map_array_register(struct iio_dev *indio_dev, struct iio_map *maps)
i++; i++;
} }
error_ret: error_ret:
if (ret)
iio_map_array_unregister_locked(indio_dev);
mutex_unlock(&iio_map_list_lock); mutex_unlock(&iio_map_list_lock);
return ret; return ret;