Skip to contentSkip to conversation

block: fix error return code in mm_pci_probe()

PATCH New Wang Hai 1 participant 1 message Nov 24, 2020 Block layer

lore
Share & tools
lore

Wang Hai

author
#0 lore raw

PATCH 1/1 block: fix error return code in mm_pci_probe()

Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function.

Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")
---
 drivers/block/umem.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/block/umem.c +4 -1
index 2b95d7b33b91..5eb44e4a91ee 100644
@@ -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);
 
Signature · 1 line
2.17.1