From 077f5d900f62a817b155e614e7eb79220b1405de Mon Sep 17 00:00:00 2001 From: Yang Yingliang Date: Wed, 11 May 2022 14:45:06 +0800 Subject: [PATCH] drivers: dio: add missing iounmap() in dio_init() If kzalloc() fails, iounmap() need be called in error path. Signed-off-by: Yang Yingliang Link: https://lore.kernel.org/r/20220511064506.3398512-1-yangyingliang@huawei.com Signed-off-by: Greg Kroah-Hartman --- drivers/dio/dio.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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;