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>
This commit is contained in:
Yang Yingliang 2022-05-11 14:45:06 +08:00 committed by Greg Kroah-Hartman
parent 106101303e
commit 077f5d900f
1 changed files with 4 additions and 1 deletions

View File

@ -216,8 +216,11 @@ static int __init dio_init(void)
/* Found a board, allocate it an entry in the list */ /* Found a board, allocate it an entry in the list */
dev = kzalloc(sizeof(struct dio_dev), GFP_KERNEL); dev = kzalloc(sizeof(struct dio_dev), GFP_KERNEL);
if (!dev) if (!dev) {
if (scode >= DIOII_SCBASE)
iounmap(va);
return -ENOMEM; return -ENOMEM;
}
dev->bus = &dio_bus; dev->bus = &dio_bus;
dev->dev.parent = &dio_bus.dev; dev->dev.parent = &dio_bus.dev;