linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] umem: fix error return code in mm_pci_probe()
@ 2021-03-08 12:35 'Wei Yongjun
  2021-03-09 20:56 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: 'Wei Yongjun @ 2021-03-08 12:35 UTC (permalink / raw)
  To: weiyongjun1, Jens Axboe; +Cc: linux-block, Hulk Robot

From: Wei Yongjun <weiyongjun1@huawei.com>

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>
---
 drivers/block/umem.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/block/umem.c b/drivers/block/umem.c
index 982732dbe82e..664280f23bee 100644
--- a/drivers/block/umem.c
+++ b/drivers/block/umem.c
@@ -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]);
@@ -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);
 


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH -next] umem: fix error return code in mm_pci_probe()
  2021-03-08 12:35 [PATCH -next] umem: fix error return code in mm_pci_probe() 'Wei Yongjun
@ 2021-03-09 20:56 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2021-03-09 20:56 UTC (permalink / raw)
  To: 'Wei Yongjun; +Cc: linux-block, Hulk Robot

On 3/8/21 5:35 AM, 'Wei Yongjun wrote:
> From: Wei Yongjun <weiyongjun1@huawei.com>
> 
> 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.

Applied, thanks.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-09 20:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-08 12:35 [PATCH -next] umem: fix error return code in mm_pci_probe() 'Wei Yongjun
2021-03-09 20:56 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).