Commit 77291852 authored by Christophe JAILLET's avatar Christophe JAILLET Committed by Jens Axboe

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: 	fd8383fd ("nbd: convert to blkmq")
Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
parent bc33b0ca
...@@ -599,7 +599,7 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd, ...@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment