[PATCH] staging: xillybus: Return -ENOMEM if *_iomap fails instead of 0

Eli Billauer eli.billauer at gmail.com
Mon Dec 16 13:50:39 UTC 2013


Bug fix: The error code was not set, so the error condition wasn't reflected
in the return value.

Reported-by: Wei Yongjun <yongjun_wei at trendmicro.com.cn>
Signed-off-by: Eli Billauer <eli.billauer at gmail.com>
---
 drivers/staging/xillybus/xillybus_of.c   |    2 +-
 drivers/staging/xillybus/xillybus_pcie.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/xillybus/xillybus_of.c b/drivers/staging/xillybus/xillybus_of.c
index 394bfea..97fbcf4 100644
--- a/drivers/staging/xillybus/xillybus_of.c
+++ b/drivers/staging/xillybus/xillybus_of.c
@@ -131,10 +131,10 @@ static int xilly_drv_probe(struct platform_device *op)
 	}
 
 	endpoint->registers = of_iomap(dev->of_node, 0);
-
 	if (!endpoint->registers) {
 		dev_err(endpoint->dev,
 			"Failed to map I/O memory. Aborting.\n");
+		rc = -ENOMEM;
 		goto failed_iomap0;
 	}
 
diff --git a/drivers/staging/xillybus/xillybus_pcie.c b/drivers/staging/xillybus/xillybus_pcie.c
index 0564f97..bf1f7e3 100644
--- a/drivers/staging/xillybus/xillybus_pcie.c
+++ b/drivers/staging/xillybus/xillybus_pcie.c
@@ -168,9 +168,9 @@ static int xilly_probe(struct pci_dev *pdev,
 	}
 
 	endpoint->registers = pci_iomap(pdev, 0, 128);
-
 	if (!endpoint->registers) {
 		dev_err(endpoint->dev, "Failed to map BAR 0. Aborting.\n");
+		rc = -ENOMEM;
 		goto failed_iomap0;
 	}
 
-- 
1.7.2.3



More information about the devel mailing list