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

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