lkml.org 
[lkml]   [2016]   [Dec]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/1] memstick: host: fix improper return value
Date
From: Pan Bian <bianpan2016@163.com>

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 <bianpan2016@163.com>
---
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

\
 
 \ /
  Last update: 2016-12-04 06:33    [W:0.039 / U:1.936 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site