Blame SOURCES/0001-scsi-3ware-fix-return-0-on-the-error-path-of-probe.patch

Kmods SIG 65bc68
From 4dc98c1995482262e70e83ef029135247fafe0f2 Mon Sep 17 00:00:00 2001
Kmods SIG 65bc68
From: Anton Vasilyev <vasilyev@ispras.ru>
Kmods SIG 65bc68
Date: Fri, 27 Jul 2018 16:51:57 +0300
Kmods SIG 65bc68
Subject: [Backport 4dc98c199548] scsi: 3ware: fix return 0 on the error path
Kmods SIG 65bc68
 of probe
Kmods SIG 65bc68
Kmods SIG 65bc68
tw_probe() returns 0 in case of fail of tw_initialize_device_extension(),
Kmods SIG 65bc68
pci_resource_start() or tw_reset_sequence() and releases resources.
Kmods SIG 65bc68
twl_probe() returns 0 in case of fail of twl_initialize_device_extension(),
Kmods SIG 65bc68
pci_iomap() and twl_reset_sequence().  twa_probe() returns 0 in case of
Kmods SIG 65bc68
fail of tw_initialize_device_extension(), ioremap() and
Kmods SIG 65bc68
twa_reset_sequence().
Kmods SIG 65bc68
Kmods SIG 65bc68
The patch adds retval initialization for these cases.
Kmods SIG 65bc68
Kmods SIG 65bc68
Found by Linux Driver Verification project (linuxtesting.org).
Kmods SIG 65bc68
Kmods SIG 65bc68
Signed-off-by: Anton Vasilyev <vasilyev@ispras.ru>
Kmods SIG 65bc68
Acked-by: Adam Radford <aradford@gmail.com>
Kmods SIG 65bc68
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Kmods SIG 65bc68
---
Kmods SIG 65bc68
 src/3w-9xxx.c | 6 +++++-
Kmods SIG 65bc68
 1 file changed, 5 insertions(+), 1 deletion(-)
Kmods SIG 65bc68
Kmods SIG 65bc68
diff --git a/src/3w-9xxx.c b/src/3w-9xxx.c
Kmods SIG 65bc68
index 99ba4a770406e3d50bfa16ccc0bd2f392bda3ca5..27521fc3ef5abc4008d617862dcb1ca473ed925d 100644
Kmods SIG 65bc68
--- a/src/3w-9xxx.c
Kmods SIG 65bc68
+++ b/src/3w-9xxx.c
Kmods SIG 65bc68
@@ -2038,6 +2038,7 @@ static int twa_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
Kmods SIG 65bc68
 
Kmods SIG 65bc68
 	if (twa_initialize_device_extension(tw_dev)) {
Kmods SIG 65bc68
 		TW_PRINTK(tw_dev->host, TW_DRIVER, 0x25, "Failed to initialize device extension");
Kmods SIG 65bc68
+		retval = -ENOMEM;
Kmods SIG 65bc68
 		goto out_free_device_extension;
Kmods SIG 65bc68
 	}
Kmods SIG 65bc68
 
Kmods SIG 65bc68
@@ -2060,6 +2061,7 @@ static int twa_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
Kmods SIG 65bc68
 	tw_dev->base_addr = ioremap(mem_addr, mem_len);
Kmods SIG 65bc68
 	if (!tw_dev->base_addr) {
Kmods SIG 65bc68
 		TW_PRINTK(tw_dev->host, TW_DRIVER, 0x35, "Failed to ioremap");
Kmods SIG 65bc68
+		retval = -ENOMEM;
Kmods SIG 65bc68
 		goto out_release_mem_region;
Kmods SIG 65bc68
 	}
Kmods SIG 65bc68
 
Kmods SIG 65bc68
@@ -2067,8 +2069,10 @@ static int twa_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
Kmods SIG 65bc68
 	TW_DISABLE_INTERRUPTS(tw_dev);
Kmods SIG 65bc68
 
Kmods SIG 65bc68
 	/* Initialize the card */
Kmods SIG 65bc68
-	if (twa_reset_sequence(tw_dev, 0))
Kmods SIG 65bc68
+	if (twa_reset_sequence(tw_dev, 0)) {
Kmods SIG 65bc68
+		retval = -ENOMEM;
Kmods SIG 65bc68
 		goto out_iounmap;
Kmods SIG 65bc68
+	}
Kmods SIG 65bc68
 
Kmods SIG 65bc68
 	/* Set host specific parameters */
Kmods SIG 65bc68
 	if ((pdev->device == PCI_DEVICE_ID_3WARE_9650SE) ||
Kmods SIG 65bc68
-- 
Kmods SIG 65bc68
2.31.1
Kmods SIG 65bc68