From b93c8994033cb82b38c526872d9b004216eabc6a Mon Sep 17 00:00:00 2001 From: Thomas Schoebel-Theuer Date: Wed, 27 Jul 2022 10:01:21 +0200 Subject: [PATCH] brick: improve error code --- kernel/brick.c | 5 +---- kernel/brick.h | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/kernel/brick.c b/kernel/brick.c index a256aa39..8fc08e2d 100644 --- a/kernel/brick.c +++ b/kernel/brick.c @@ -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; } diff --git a/kernel/brick.h b/kernel/brick.h index 9b25c464..78a7a203 100644 --- a/kernel/brick.h +++ b/kernel/brick.h @@ -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);