[PATCH 10/10] resource: Let request_ioport_region return an error pointer

Sascha Hauer s.hauer at pengutronix.de
Fri Sep 12 03:13:50 PDT 2014


Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 common/resource.c               | 2 +-
 drivers/serial/serial_ns16550.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/common/resource.c b/common/resource.c
index fd04f26..e4bbe15 100644
--- a/common/resource.c
+++ b/common/resource.c
@@ -146,7 +146,7 @@ struct resource *request_ioport_region(const char *name,
 
 	res = __request_region(&ioport_resource, name, start, end);
 	if (IS_ERR(res))
-		return NULL;
+		return ERR_CAST(res);
 
 	return res;
 }
diff --git a/drivers/serial/serial_ns16550.c b/drivers/serial/serial_ns16550.c
index 78a674a..4ca7444 100644
--- a/drivers/serial/serial_ns16550.c
+++ b/drivers/serial/serial_ns16550.c
@@ -353,8 +353,8 @@ static int ns16550_init_ioport(struct device_d *dev, struct ns16550_priv *priv)
 		return PTR_ERR(res);
 
 	res = request_ioport_region(dev_name(dev), res->start, res->end);
-	if (!res)
-		return -ENODEV;
+	if (IS_ERR(res))
+		return PTR_ERR(res);
 
 	priv->iobase = res->start;
 
-- 
2.1.0




More information about the barebox mailing list