Browse Source

nbd: Fix error handling

'blk_mq_alloc_request()' returns an error pointer in case of error, not
NULL. So test it with IS_ERR.

Fixes: 	fd8383fd88a2 ("nbd: convert to blkmq")

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Jens Axboe <axboe@fb.com>
Christophe JAILLET 8 years ago
parent
commit
772918524d
1 changed files with 1 additions and 1 deletions
  1. 1 1
      drivers/block/nbd.c

+ 1 - 1
drivers/block/nbd.c

@@ -599,7 +599,7 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd,
 			return -EINVAL;
 			return -EINVAL;
 
 
 		sreq = blk_mq_alloc_request(bdev_get_queue(bdev), WRITE, 0);
 		sreq = blk_mq_alloc_request(bdev_get_queue(bdev), WRITE, 0);
-		if (!sreq)
+		if (IS_ERR(sreq))
 			return -ENOMEM;
 			return -ENOMEM;
 
 
 		mutex_unlock(&nbd->tx_lock);
 		mutex_unlock(&nbd->tx_lock);