On 2012-07-01 14:36, Devendra Naga wrote:
if alloc_private fail, we wont' release the I/O region, which was request_region 'ed. release the allocated I/O region if alloc_private fails. Signed-off-by: Devendra Naga <devendra.aaru@xxxxxxxxx> --- drivers/staging/comedi/drivers/fl512.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/comedi/drivers/fl512.c b/drivers/staging/comedi/drivers/fl512.c index d1da809..52e6d14 100644 --- a/drivers/staging/comedi/drivers/fl512.c +++ b/drivers/staging/comedi/drivers/fl512.c @@ -125,8 +125,10 @@ static int fl512_attach(struct comedi_device *dev, struct comedi_devconfig *it) } dev->iobase = iobase; dev->board_name = "fl512"; - if (alloc_private(dev, sizeof(struct fl512_private)) < 0) + if (alloc_private(dev, sizeof(struct fl512_private)) < 0) { + release_region(iobase, FL512_SIZE); return -ENOMEM; + } #if DEBUG printk(KERN_DEBUG "malloc ok\n");
No. The I/O region will be deallocated in fl512_detach() because dev->iobase has been set non-zero. fl512_detach() will be called by the comedi core if fl512_attach() returns an error. This is an unusual aspect of the comedi drivers.
-- -=( Ian Abbott @ MEV Ltd. E-mail: <abbotti@xxxxxxxxx> )=- -=( Tel: +44 (0)161 477 1898 FAX: +44 (0)161 718 3587 )=- _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/devel