mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 06:44:00 -04:00
bcache: Remove unnecessary NULL point check in node allocations
Due to the previous fix of __bch_btree_node_alloc, the return value will
never be a NULL pointer. So IS_ERR is enough to handle the failure
situation. Fix it by replacing IS_ERR_OR_NULL check by an IS_ERR check.
Fixes: cafe563591 ("bcache: A block layer cache")
Cc: stable@vger.kernel.org
Signed-off-by: Zheng Wang <zyytlz.wz@163.com>
Signed-off-by: Coly Li <colyli@suse.de>
Link: https://lore.kernel.org/r/20230615121223.22502-5-colyli@suse.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
@@ -1723,7 +1723,7 @@ static void cache_set_flush(struct closure *cl)
|
||||
if (!IS_ERR_OR_NULL(c->gc_thread))
|
||||
kthread_stop(c->gc_thread);
|
||||
|
||||
if (!IS_ERR_OR_NULL(c->root))
|
||||
if (!IS_ERR(c->root))
|
||||
list_add(&c->root->list, &c->btree_cache);
|
||||
|
||||
/*
|
||||
@@ -2087,7 +2087,7 @@ static int run_cache_set(struct cache_set *c)
|
||||
|
||||
err = "cannot allocate new btree root";
|
||||
c->root = __bch_btree_node_alloc(c, NULL, 0, true, NULL);
|
||||
if (IS_ERR_OR_NULL(c->root))
|
||||
if (IS_ERR(c->root))
|
||||
goto err;
|
||||
|
||||
mutex_lock(&c->root->write_lock);
|
||||
|
||||
Reference in New Issue
Block a user