brick: improve error code

This commit is contained in:
Thomas Schoebel-Theuer 2022-07-27 10:01:21 +02:00
parent da1ef56fef
commit b93c899403
2 changed files with 2 additions and 5 deletions

View File

@ -132,7 +132,7 @@ int generic_register_brick_type(const struct generic_brick_type *new_type)
if (found < 0) {
if (nr_brick_types >= MAX_BRICK_TYPES) {
BRICK_ERR("sorry, cannot register bricktype %s.\n", new_type->type_name);
return -ENOMEM;
return -EINVAL;
}
found = nr_brick_types++;
}
@ -687,9 +687,6 @@ EXPORT_SYMBOL_GPL(free_meta);
int __init init_brick(void)
{
nr_table = brick_zmem_alloc(nr_max);
if (!nr_table) {
return -ENOMEM;
}
return 0;
}

View File

@ -516,7 +516,7 @@ INLINE void generic_input_exit(struct generic_input *input)
INLINE int generic_output_init(struct generic_brick *brick, int index, const struct generic_output_type *type, struct generic_output *output, const char *output_name)
{
if (index < 0 || index >= brick->type->max_outputs)
return -ENOMEM;
return -EINVAL;
if (brick->outputs[index])
return -EEXIST;
_generic_output_init(brick, type, output, output_name);