summaryrefslogtreecommitdiff
path: root/drivers/iio/industrialio-sw-trigger.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/iio/industrialio-sw-trigger.c')
-rw-r--r--drivers/iio/industrialio-sw-trigger.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/iio/industrialio-sw-trigger.c b/drivers/iio/industrialio-sw-trigger.c
index 9ae793a70b8b..d86a3305d9e8 100644
--- a/drivers/iio/industrialio-sw-trigger.c
+++ b/drivers/iio/industrialio-sw-trigger.c
@@ -27,7 +27,7 @@ static DEFINE_MUTEX(iio_trigger_types_lock);
static
struct iio_sw_trigger_type *__iio_find_sw_trigger_type(const char *name,
- unsigned len)
+ unsigned int len)
{
struct iio_sw_trigger_type *t = NULL, *iter;
@@ -58,8 +58,12 @@ int iio_register_sw_trigger_type(struct iio_sw_trigger_type *t)
t->group = configfs_register_default_group(iio_triggers_group, t->name,
&iio_trigger_type_group_type);
- if (IS_ERR(t->group))
+ if (IS_ERR(t->group)) {
+ mutex_lock(&iio_trigger_types_lock);
+ list_del(&t->list);
+ mutex_unlock(&iio_trigger_types_lock);
ret = PTR_ERR(t->group);
+ }
return ret;
}