diff options
author | Christophe JAILLET <christophe.jaillet@wanadoo.fr> | 2016-10-30 00:28:27 -0400 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2016-11-06 16:14:59 -0500 |
commit | 772918524dfb8c8869120728c1b1109a2d49493c (patch) | |
tree | 387018dd45b281964a3f1c64766b3efb98a784fc | |
parent | bc33b0ca11e3df467777a4fa7639ba488c9d4911 (diff) |
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>
-rw-r--r-- | drivers/block/nbd.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index 19a16b2dbb91..7a1048755914 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c | |||
@@ -599,7 +599,7 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd, | |||
599 | return -EINVAL; | 599 | return -EINVAL; |
600 | 600 | ||
601 | sreq = blk_mq_alloc_request(bdev_get_queue(bdev), WRITE, 0); | 601 | sreq = blk_mq_alloc_request(bdev_get_queue(bdev), WRITE, 0); |
602 | if (!sreq) | 602 | if (IS_ERR(sreq)) |
603 | return -ENOMEM; | 603 | return -ENOMEM; |
604 | 604 | ||
605 | mutex_unlock(&nbd->tx_lock); | 605 | mutex_unlock(&nbd->tx_lock); |