dm-bow: Fix 5.15 compatibility issue
[platform/kernel/linux-rpi.git] / drivers / iio / industrialio-sw-trigger.c
index 9ae793a..a7714d3 100644 (file)
@@ -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;
 }