[PATCH] applicom: fix unreleased RamIO

10 views
Skip to first unread message

Haoyang Liu

unread,
Apr 28, 2024, 8:13:11 AMApr 28
to hust-os-ker...@googlegroups.com, Haoyang Liu
Add iounmap() to release RamIO that not released before returning;

Signed-off-by: Haoyang Liu <ttttur...@hust.edu.cn>
---
drivers/char/applicom.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/char/applicom.c b/drivers/char/applicom.c
index 69314532f38c..a455d85db7de 100644
--- a/drivers/char/applicom.c
+++ b/drivers/char/applicom.c
@@ -251,6 +251,7 @@ static int __init applicom_init(void)
else {
printk(KERN_INFO "ac.o: No PCI boards found.\n");
printk(KERN_INFO "ac.o: For an ISA board you must supply memory and irq parameters.\n");
+ iounmap(RamIO);
return -ENXIO;
}
}
@@ -335,8 +336,10 @@ static int __init applicom_init(void)
return 0;
}

- else
+ else {
+ iounmap(RamIO);
return -ENXIO;
+ }

out:
for (i = 0; i < MAX_BOARD; i++) {
@@ -346,6 +349,7 @@ static int __init applicom_init(void)
free_irq(apbs[i].irq, &dummy);
iounmap(apbs[i].RamIO);
}
+ iounmap(RamIO);
return ret;
}

--
2.25.1

Dan Carpenter

unread,
Apr 28, 2024, 10:02:06 AMApr 28
to Haoyang Liu, hust-os-ker...@googlegroups.com
On Sun, Apr 28, 2024 at 08:12:41PM +0800, Haoyang Liu wrote:
> Add iounmap() to release RamIO that not released before returning;
>
> Signed-off-by: Haoyang Liu <ttttur...@hust.edu.cn>
> ---
> drivers/char/applicom.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/char/applicom.c b/drivers/char/applicom.c
> index 69314532f38c..a455d85db7de 100644
> --- a/drivers/char/applicom.c
> +++ b/drivers/char/applicom.c
> @@ -251,6 +251,7 @@ static int __init applicom_init(void)
> else {
> printk(KERN_INFO "ac.o: No PCI boards found.\n");
> printk(KERN_INFO "ac.o: For an ISA board you must supply memory and irq parameters.\n");
> + iounmap(RamIO);
> return -ENXIO;
> }
> }

This is a loop so the cleanup only cleans up the most recent iomap and
leaves the rest.

Honestly, I would just leave this driver as is. It's ancient and it's
probably necessary to boot so if it fails cleaning up is pointless
because the system is unusable.

regards,
dan carpenter

Reply all
Reply to author
Forward
0 new messages