bcache: fix error info in register_bcache()
authorChao Yu <yuchao0@huawei.com>
Wed, 20 Oct 2021 14:38:07 +0000 (22:38 +0800)
committerJens Axboe <axboe@kernel.dk>
Wed, 20 Oct 2021 14:40:54 +0000 (08:40 -0600)
commitd55f7cb2e5c053010d2b527494da9bbb722a78ba
tree9a5e6cd38a8fec1bea2acc91c16845849aed06a6
parent0a2b3e363566c4cc8792d37c5e73b9d9295e075c
bcache: fix error info in register_bcache()

In register_bcache(), there are several cases we didn't set
correct error info (return value and/or error message):
- if kzalloc() fails, it needs to return ENOMEM and print
"cannot allocate memory";
- if register_cache() fails, it's better to propagate its
return value rather than using default EINVAL.

Signed-off-by: Chao Yu <yuchao0@huawei.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Coly Li <colyli@suse.de>
Link: https://lore.kernel.org/r/20211020143812.6403-4-colyli@suse.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/md/bcache/super.c