Skip to contentSkip to conversation

drivers: dio: add missing iounmap() in dio_init()

PATCH New Yang Yingliang 1 participant 1 message May 11, 2022

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 drivers: dio: add missing iounmap() in dio_init()

If kzalloc() fails, iounmap() need be called in error path.

---
v2:
make the title and commit message more properly.

---
 drivers/dio/dio.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/dio/dio.c +4 -1
index 005a82f671c3..0e5a5662d5a4 100644
@@ -216,8 +216,11 @@ static int __init dio_init(void)
 
 		/* Found a board, allocate it an entry in the list */
 		dev = kzalloc(sizeof(struct dio_dev), GFP_KERNEL);
-		if (!dev)
+		if (!dev) {
+			if (scode >= DIOII_SCBASE)
+				iounmap(va);
 			return -ENOMEM;
+		}
 
 		dev->bus = &dio_bus;
 		dev->dev.parent = &dio_bus.dev;
Signature · 1 line
2.25.1