[PATCH] drivers/base: bail out if request_iomem_region fails

Sascha Hauer s.hauer at pengutronix.de
Wed Jun 27 09:56:44 EDT 2012


When request_iomem_region fails we have to bail out instead of
dereferencing res->start.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 drivers/base/driver.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index 3be4b99..81cedca 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -262,6 +262,8 @@ void __iomem *dev_request_mem_region(struct device_d *dev, int num)
 		return NULL;
 
 	res = request_iomem_region(dev_name(dev), res->start, res->size);
+	if (!res)
+		return NULL;
 
 	return (void __force __iomem *)res->start;
 }
-- 
1.7.10




More information about the barebox mailing list