Skip to contentSkip to conversation

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

PATCH Applied Dan Carpenter 4 participants 4 messages Jun 18, 2021 – Jun 19, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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

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")
---
 include/linux/blk-mq.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/blk-mq.h +1 -1
index 02a4aab0aeac..fd2de2b422ed 100644
@@ -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;								\
Signature · 1 line
2.30.2
maintainer Applied
#2 lore raw
In reply to Dan Carpenter
Quoted 2 lines · Dan Carpenter

The __blk_mq_alloc_disk() function doesn't return NULLs it returns error pointers.

Applied, thanks.

Signature · 1 line
Jens Axboe