diff mbox series

blk-mq: fix an IS_ERR() vs NULL bug

Message ID YMyjci35WBqrtqG+@mwanda (mailing list archive)
State New, archived
Headers show
Series blk-mq: fix an IS_ERR() vs NULL bug | expand

Commit Message

Dan Carpenter June 18, 2021, 1:45 p.m. UTC
The __blk_mq_alloc_disk() function doesn't return NULLs it returns
error pointers.

Fixes: b461dfc49eb6 ("blk-mq: add the blk_mq_alloc_disk APIs")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 include/linux/blk-mq.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Christoph Hellwig June 18, 2021, 2:07 p.m. UTC | #1
On Fri, Jun 18, 2021 at 04:45:22PM +0300, Dan Carpenter wrote:
> The __blk_mq_alloc_disk() function doesn't return NULLs it returns
> error pointers.
> 
> Fixes: b461dfc49eb6 ("blk-mq: add the blk_mq_alloc_disk APIs")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>
Jens Axboe June 18, 2021, 2:53 p.m. UTC | #2
On 6/18/21 7:45 AM, Dan Carpenter wrote:
> The __blk_mq_alloc_disk() function doesn't return NULLs it returns
> error pointers.

Applied, thanks.
Chaitanya Kulkarni June 19, 2021, 11:02 p.m. UTC | #3
On 6/18/21 06:45, Dan Carpenter wrote:
> The __blk_mq_alloc_disk() function doesn't return NULLs it returns
> error pointers.
>
> Fixes: b461dfc49eb6 ("blk-mq: add the blk_mq_alloc_disk APIs")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Thanks for the fix, looks good.

Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
diff mbox series

Patch

diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index 02a4aab0aeac..fd2de2b422ed 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -431,7 +431,7 @@  enum {
 	static struct lock_class_key __key;				\
 	struct gendisk *__disk = __blk_mq_alloc_disk(set, queuedata);	\
 									\
-	if (__disk)							\
+	if (!IS_ERR(__disk))						\
 		lockdep_init_map(&__disk->lockdep_map,			\
 			"(bio completion)", &__key, 0);			\
 	__disk;								\