|
Kmods SIG |
ccfb2b |
From 4dc98c1995482262e70e83ef029135247fafe0f2 Mon Sep 17 00:00:00 2001
|
|
Kmods SIG |
ccfb2b |
From: Anton Vasilyev <vasilyev@ispras.ru>
|
|
Kmods SIG |
ccfb2b |
Date: Fri, 27 Jul 2018 16:51:57 +0300
|
|
Kmods SIG |
ccfb2b |
Subject: [Backport 4dc98c199548] scsi: 3ware: fix return 0 on the error path
|
|
Kmods SIG |
ccfb2b |
of probe
|
|
Kmods SIG |
ccfb2b |
|
|
Kmods SIG |
ccfb2b |
tw_probe() returns 0 in case of fail of tw_initialize_device_extension(),
|
|
Kmods SIG |
ccfb2b |
pci_resource_start() or tw_reset_sequence() and releases resources.
|
|
Kmods SIG |
ccfb2b |
twl_probe() returns 0 in case of fail of twl_initialize_device_extension(),
|
|
Kmods SIG |
ccfb2b |
pci_iomap() and twl_reset_sequence(). twa_probe() returns 0 in case of
|
|
Kmods SIG |
ccfb2b |
fail of tw_initialize_device_extension(), ioremap() and
|
|
Kmods SIG |
ccfb2b |
twa_reset_sequence().
|
|
Kmods SIG |
ccfb2b |
|
|
Kmods SIG |
ccfb2b |
The patch adds retval initialization for these cases.
|
|
Kmods SIG |
ccfb2b |
|
|
Kmods SIG |
ccfb2b |
Found by Linux Driver Verification project (linuxtesting.org).
|
|
Kmods SIG |
ccfb2b |
|
|
Kmods SIG |
ccfb2b |
Signed-off-by: Anton Vasilyev <vasilyev@ispras.ru>
|
|
Kmods SIG |
ccfb2b |
Acked-by: Adam Radford <aradford@gmail.com>
|
|
Kmods SIG |
ccfb2b |
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
|
|
Kmods SIG |
ccfb2b |
---
|
|
Kmods SIG |
ccfb2b |
src/3w-sas.c | 3 +++
|
|
Kmods SIG |
ccfb2b |
1 file changed, 3 insertions(+)
|
|
Kmods SIG |
ccfb2b |
|
|
Kmods SIG |
ccfb2b |
diff --git a/src/3w-sas.c b/src/3w-sas.c
|
|
Kmods SIG |
ccfb2b |
index cf9f2a09b47d9e327457248e986adacf8e530949..40c1e6e64f58a8422e5738a3c6a12799142a6ff0 100644
|
|
Kmods SIG |
ccfb2b |
--- a/src/3w-sas.c
|
|
Kmods SIG |
ccfb2b |
+++ b/src/3w-sas.c
|
|
Kmods SIG |
ccfb2b |
@@ -1594,6 +1594,7 @@ static int twl_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
|
|
Kmods SIG |
ccfb2b |
|
|
Kmods SIG |
ccfb2b |
if (twl_initialize_device_extension(tw_dev)) {
|
|
Kmods SIG |
ccfb2b |
TW_PRINTK(tw_dev->host, TW_DRIVER, 0x1a, "Failed to initialize device extension");
|
|
Kmods SIG |
ccfb2b |
+ retval = -ENOMEM;
|
|
Kmods SIG |
ccfb2b |
goto out_free_device_extension;
|
|
Kmods SIG |
ccfb2b |
}
|
|
Kmods SIG |
ccfb2b |
|
|
Kmods SIG |
ccfb2b |
@@ -1608,6 +1609,7 @@ static int twl_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
|
|
Kmods SIG |
ccfb2b |
tw_dev->base_addr = pci_iomap(pdev, 1, 0);
|
|
Kmods SIG |
ccfb2b |
if (!tw_dev->base_addr) {
|
|
Kmods SIG |
ccfb2b |
TW_PRINTK(tw_dev->host, TW_DRIVER, 0x1c, "Failed to ioremap");
|
|
Kmods SIG |
ccfb2b |
+ retval = -ENOMEM;
|
|
Kmods SIG |
ccfb2b |
goto out_release_mem_region;
|
|
Kmods SIG |
ccfb2b |
}
|
|
Kmods SIG |
ccfb2b |
|
|
Kmods SIG |
ccfb2b |
@@ -1617,6 +1619,7 @@ static int twl_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
|
|
Kmods SIG |
ccfb2b |
/* Initialize the card */
|
|
Kmods SIG |
ccfb2b |
if (twl_reset_sequence(tw_dev, 0)) {
|
|
Kmods SIG |
ccfb2b |
TW_PRINTK(tw_dev->host, TW_DRIVER, 0x1d, "Controller reset failed during probe");
|
|
Kmods SIG |
ccfb2b |
+ retval = -ENOMEM;
|
|
Kmods SIG |
ccfb2b |
goto out_iounmap;
|
|
Kmods SIG |
ccfb2b |
}
|
|
Kmods SIG |
ccfb2b |
|
|
Kmods SIG |
ccfb2b |
--
|
|
Kmods SIG |
ccfb2b |
2.31.1
|
|
Kmods SIG |
ccfb2b |
|