From: Pan Bian <[email protected]>
When pci_ioremap_bar() returns a NULL pointer, the value of return
variable "error" is 0. 0 means no error, which is contrary to the fact.
Similarly, the return values are also improper when request_irq() or
memstick_add_host() returns unexpected values. This patch fixes the bug,
assigning "-ENOMEM" to variable "error" before the call to
pci_ioremap_bar().
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188991
Signed-off-by: Pan Bian <[email protected]>
---
drivers/memstick/host/r592.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/memstick/host/r592.c b/drivers/memstick/host/r592.c
index d5cfb50..eebed0a 100644
--- a/drivers/memstick/host/r592.c
+++ b/drivers/memstick/host/r592.c
@@ -761,6 +761,7 @@ static int r592_probe(struct pci_dev *pdev, const struct pci_device_id *id)
if (error)
goto error3;
+ error = -ENOMEM;
dev->mmio = pci_ioremap_bar(pdev, 0);
if (!dev->mmio)
goto error4;
--
1.9.1