summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYang Yingliang <yangyingliang@huawei.com>2022-05-11 09:45:06 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-05-19 19:56:51 +0300
commit077f5d900f62a817b155e614e7eb79220b1405de (patch)
tree227ff6b05cead209f00324ef9c1341df34ba7c4b
parent106101303eda8f93c65158e5d72b2cc6088ed034 (diff)
downloadlinux-077f5d900f62a817b155e614e7eb79220b1405de.tar.xz
drivers: dio: add missing iounmap() in dio_init()
If kzalloc() fails, iounmap() need be called in error path. Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Link: https://lore.kernel.org/r/20220511064506.3398512-1-yangyingliang@huawei.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/dio/dio.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/dio/dio.c b/drivers/dio/dio.c
index 005a82f671c3..0e5a5662d5a4 100644
--- a/drivers/dio/dio.c
+++ b/drivers/dio/dio.c
@@ -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;