Skip to content

Commit

Permalink
nbd: Fix error handling
Browse files Browse the repository at this point in the history
'blk_mq_alloc_request()' returns an error pointer in case of error, not
NULL. So test it with IS_ERR.

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

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Jens Axboe <axboe@fb.com>
  • Loading branch information
Christophe JAILLET authored and Jens Axboe committed Nov 6, 2016
1 parent bc33b0c commit 7729185
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/block/nbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd,
return -EINVAL;

sreq = blk_mq_alloc_request(bdev_get_queue(bdev), WRITE, 0);
if (!sreq)
if (IS_ERR(sreq))
return -ENOMEM;

mutex_unlock(&nbd->tx_lock);
Expand Down

0 comments on commit 7729185

Please sign in to comment.