drivers/isdn/sc/init.c: check request_region for
PATCH 1/1 drivers/isdn/sc/init.c: check request_region for
Check request_region() for return value
Signed-off-by Richard van Berkum <h.vanberkum at chello.nl>
---
The whole region is scaned for I/O ports and that same regions is released at module_exit. So I let module_exit clean up the mess. Is there a better way to solve this problem?
init.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/isdn/sc/init.c +9 -2
@@ -354,8 +354,15 @@ static int __init sc_init(void) sc_adapter[cinst]->iobase = io[b];for (i =0 ; i <MAX_IO_REGS -1 ; i++) { sc_adapter[cinst]->ioport[i] = io[b] + i *0x400 ; -request_region (sc_adapter[cinst]->ioport[i],1 , - interface->id); +/* +*check return value and let module_exit handle the release of the resources +*/ +if (!(request_region (sc_adapter[cinst]->ioport[i],1 , + interface->id))) { +printk (KERN_ERR "Can't get I/O %X\n" ,sc_adapter[cinst]->ioport[i]); +return -ENODEV ; + } +pr_debug ("Requesting I/O Port %#x\n" , sc_adapter[cinst]->ioport[i]); }
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors