From: Frank Mori Hess Date: Mon, 19 Jun 2006 01:21:38 +0000 (+0000) Subject: Patch from abbotti@mev.co.uk (Ian Abbott): X-Git-Tag: r0_7_71~23 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=8c0462069fcfcc8213ef3a748c782ea7d83f6480;p=comedi.git Patch from abbotti@mev.co.uk (Ian Abbott): The pcm3724 driver is still using the deprecated check_region() call. Also, it doesn't check if things were allocated properly when cleaning up in the detach routine. The attached patch fixes it. --- diff --git a/comedi/drivers/pcm3724.c b/comedi/drivers/pcm3724.c index bb26a3eb..f4f66449 100644 --- a/comedi/drivers/pcm3724.c +++ b/comedi/drivers/pcm3724.c @@ -272,12 +272,11 @@ static int pcm3724_attach(comedi_device *dev,comedi_devconfig *it) printk("comedi%d: pcm3724: board=%s, 0x%03x ",dev->minor, this_board->name,iobase); - if(check_region(iobase,iorange)<0){ + if(!iobase || !request_region(iobase, iorange, "pcm3724")){ printk("I/O port conflict\n"); return -EIO; } - request_region(iobase, iorange, "pcm3724"); dev->iobase=iobase; dev->board_name = this_board->name; printk("\n"); @@ -299,10 +298,14 @@ static int pcm3724_detach(comedi_device *dev) { int i; - for(i=0;in_subdevices;i++){ - subdev_8255_cleanup(dev,dev->subdevices+i); + if(dev->subdevices){ + for(i=0;in_subdevices;i++){ + subdev_8255_cleanup(dev,dev->subdevices+i); + } + } + if(dev->iobase){ + release_region(dev->iobase,this_board->io_range); } - release_region(dev->iobase,this_board->io_range); return 0; }