[PATCH 1/1] block: rsxx: set error code on exception path
From: Pan Bian
Date: Wed Nov 30 2016 - 22:09:31 EST
Fix bug https://bugzilla.kernel.org/show_bug.cgi?id=188541. In function
rsxx_pci_probe(), variable st takes the return value. Its value should
be negative on failures. However, the value of st is 0 even if the call
to create_singlethread_workqueue() returns a NULL pointer. This patch
fixes the bug by assigning -ENOMEM to st when the call fails.
Signed-off-by: Pan Bian <bianpan2016@xxxxxxx>
---
drivers/block/rsxx/core.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/block/rsxx/core.c b/drivers/block/rsxx/core.c
index 34997df..925bc46 100644
--- a/drivers/block/rsxx/core.c
+++ b/drivers/block/rsxx/core.c
@@ -890,6 +890,7 @@ static int rsxx_pci_probe(struct pci_dev *dev,
card->event_wq = create_singlethread_workqueue(DRIVER_NAME"_event");
if (!card->event_wq) {
dev_err(CARD_TO_DEV(card), "Failed card event setup.\n");
+ st = -ENOMEM;
goto failed_event_handler;
}
--
1.9.1