* [PATCH] block: return NULL in blk_alloc_queue() on error
@ 2020-03-28 18:27 Chaitanya Kulkarni
2020-03-28 21:32 ` Guoqing Jiang
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Chaitanya Kulkarni @ 2020-03-28 18:27 UTC (permalink / raw)
To: axboe; +Cc: linux-block, hch, Chaitanya Kulkarni
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=y, Size: 878 bytes --]
This patch fixes follwoing warning:
block/blk-core.c: In function ‘blk_alloc_queue’:
block/blk-core.c:558:10: warning: returning ‘int’ from a function with return type ‘struct request_queue *’ makes pointer from integer without a cast [-Wint-conversion]
return -EINVAL;
Fixes: 3d745ea5b095a ("block: simplify queue allocation")
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
block/blk-core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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;
q = __blk_alloc_queue(node_id);
if (!q)
--
2.22.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] block: return NULL in blk_alloc_queue() on error
2020-03-28 18:27 [PATCH] block: return NULL in blk_alloc_queue() on error Chaitanya Kulkarni
@ 2020-03-28 21:32 ` Guoqing Jiang
2020-03-28 23:42 ` Chaitanya Kulkarni
2020-03-29 12:09 ` Christoph Hellwig
2020-03-29 16:08 ` Jens Axboe
2 siblings, 1 reply; 6+ messages in thread
From: Guoqing Jiang @ 2020-03-28 21:32 UTC (permalink / raw)
To: Chaitanya Kulkarni, axboe; +Cc: linux-block, hch
On 3/28/20 7:27 PM, Chaitanya Kulkarni wrote:
> This patch fixes follwoing warning:
>
> block/blk-core.c: In function ‘blk_alloc_queue’:
> block/blk-core.c:558:10: warning: returning ‘int’ from a function with return type ‘struct request_queue *’ makes pointer from integer without a cast [-Wint-conversion]
> return -EINVAL;
>
> Fixes: 3d745ea5b095a ("block: simplify queue allocation")
> Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
> ---
> block/blk-core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> 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.
Thanks,
Guoqing
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] block: return NULL in blk_alloc_queue() on error
2020-03-28 21:32 ` Guoqing Jiang
@ 2020-03-28 23:42 ` Chaitanya Kulkarni
2020-03-29 12:10 ` hch
0 siblings, 1 reply; 6+ messages in thread
From: Chaitanya Kulkarni @ 2020-03-28 23:42 UTC (permalink / raw)
To: Guoqing Jiang, axboe; +Cc: linux-block, hch
On 03/28/2020 02:32 PM, Guoqing Jiang wrote:
>> >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
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] block: return NULL in blk_alloc_queue() on error
2020-03-28 18:27 [PATCH] block: return NULL in blk_alloc_queue() on error Chaitanya Kulkarni
2020-03-28 21:32 ` Guoqing Jiang
@ 2020-03-29 12:09 ` Christoph Hellwig
2020-03-29 16:08 ` Jens Axboe
2 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2020-03-29 12:09 UTC (permalink / raw)
To: Chaitanya Kulkarni; +Cc: axboe, linux-block, hch
On Sat, Mar 28, 2020 at 11:27:34AM -0700, Chaitanya Kulkarni wrote:
> This patch fixes follwoing warning:
>
> block/blk-core.c: In function ‘blk_alloc_queue’:
> block/blk-core.c:558:10: warning: returning ‘int’ from a function with return type ‘struct request_queue *’ makes pointer from integer without a cast [-Wint-conversion]
> return -EINVAL;
>
> Fixes: 3d745ea5b095a ("block: simplify queue allocation")
> Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Oops. Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] block: return NULL in blk_alloc_queue() on error
2020-03-28 23:42 ` Chaitanya Kulkarni
@ 2020-03-29 12:10 ` hch
0 siblings, 0 replies; 6+ messages in thread
From: hch @ 2020-03-29 12:10 UTC (permalink / raw)
To: Chaitanya Kulkarni; +Cc: Guoqing Jiang, axboe, linux-block, hch
On Sat, Mar 28, 2020 at 11:42:17PM +0000, Chaitanya Kulkarni wrote:
> >> >@@ -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.
The callers can't handle an ERR_PTR, so v1 is correct.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] block: return NULL in blk_alloc_queue() on error
2020-03-28 18:27 [PATCH] block: return NULL in blk_alloc_queue() on error Chaitanya Kulkarni
2020-03-28 21:32 ` Guoqing Jiang
2020-03-29 12:09 ` Christoph Hellwig
@ 2020-03-29 16:08 ` Jens Axboe
2 siblings, 0 replies; 6+ messages in thread
From: Jens Axboe @ 2020-03-29 16:08 UTC (permalink / raw)
To: Chaitanya Kulkarni; +Cc: linux-block, hch
On 3/28/20 12:27 PM, Chaitanya Kulkarni wrote:
> This patch fixes follwoing warning:
>
> block/blk-core.c: In function ‘blk_alloc_queue’:
> block/blk-core.c:558:10: warning: returning ‘int’ from a function with return type ‘struct request_queue *’ makes pointer from integer without a cast [-Wint-conversion]
> return -EINVAL;
Applied, thanks.
--
Jens Axboe
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-03-29 16:09 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-28 18:27 [PATCH] block: return NULL in blk_alloc_queue() on error Chaitanya Kulkarni
2020-03-28 21:32 ` Guoqing Jiang
2020-03-28 23:42 ` Chaitanya Kulkarni
2020-03-29 12:10 ` hch
2020-03-29 12:09 ` Christoph Hellwig
2020-03-29 16:08 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).