Thread (6 messages) 6 messages, 4 authors, 2020-03-29

Re: [PATCH] block: return NULL in blk_alloc_queue() on error

From: Chaitanya Kulkarni <hidden>
Date: 2020-03-28 23:42:34

On 03/28/2020 02:32 PM, Guoqing Jiang wrote:
quoted
quoted
diff --git a/block/blk-core.c b/block/blk-core.c
index 18b8c09d093e..7e4a1da0715e 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -555,7 +555,7 @@ struct request_queue *blk_alloc_queue(make_request_fn make_request, int node_id)
  	struct request_queue *q;

  	if (WARN_ON_ONCE(!make_request))
-		return -EINVAL;
+		return NULL;
Maybe return ERR_PTR(-EINVAL) is better.
Initially I used that, what if existing callers are reallying on
NULL vs !NULL return value ? Use of NULL just makes the code
consistent with existing return value.

If Jens is okay with ERR_PTR(), I'll send V2.
Thanks,
Guoqing
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help