From: Chengguang Xu Date: Sun, 16 Dec 2018 09:35:00 +0000 (+0800) Subject: block: loop: check error using IS_ERR instead of IS_ERR_OR_NULL in loop_add() X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=38a3499f6d0cb15bd673e517b0656807e22bfd24;p=openwrt%2Fstaging%2Fblogic.git block: loop: check error using IS_ERR instead of IS_ERR_OR_NULL in loop_add() blk_mq_init_queue() will not return NULL pointer to its caller, so it's better to replace IS_ERR_OR_NULL using IS_ERR in loop_add(). If in the future things change to check NULL pointer inside loop_add(), we should return -ENOMEM as return code instead of PTR_ERR(NULL). Signed-off-by: Chengguang Xu Signed-off-by: Jens Axboe --- diff --git a/drivers/block/loop.c b/drivers/block/loop.c index 0770004616de..0939f36548c9 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -1915,7 +1915,7 @@ static int loop_add(struct loop_device **l, int i) goto out_free_idr; lo->lo_queue = blk_mq_init_queue(&lo->tag_set); - if (IS_ERR_OR_NULL(lo->lo_queue)) { + if (IS_ERR(lo->lo_queue)) { err = PTR_ERR(lo->lo_queue); goto out_cleanup_tags; }