Skip to content

Commit

Permalink
umem: fix error return code in mm_pci_probe()
Browse files Browse the repository at this point in the history
[ Upstream commit eeb0559 ]

Fix to return negative error code -ENOMEM from the blk_alloc_queue()
and dma_alloc_coherent() error handling cases instead of 0, as done
elsewhere in this function.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Link: https://lore.kernel.org/r/20210308123501.2573816-1-weiyongjun1@huawei.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Wei Yongjun authored and gregkh committed Mar 30, 2021
1 parent 207e723 commit a4b0e21
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/block/umem.c
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,7 @@ static int mm_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
if (card->mm_pages[0].desc == NULL ||
card->mm_pages[1].desc == NULL) {
dev_printk(KERN_ERR, &card->dev->dev, "alloc failed\n");
ret = -ENOMEM;
goto failed_alloc;
}
reset_page(&card->mm_pages[0]);
Expand All @@ -888,8 +889,10 @@ static int mm_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
spin_lock_init(&card->lock);

card->queue = blk_alloc_queue(NUMA_NO_NODE);
if (!card->queue)
if (!card->queue) {
ret = -ENOMEM;
goto failed_alloc;
}

tasklet_init(&card->tasklet, process_page, (unsigned long)card);

Expand Down

0 comments on commit a4b0e21

Please sign in to comment.