From 8c0462069fcfcc8213ef3a748c782ea7d83f6480 Mon Sep 17 00:00:00 2001 From: Frank Mori Hess Date: Mon, 19 Jun 2006 01:21:38 +0000 Subject: [PATCH] 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. --- comedi/drivers/pcm3724.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) 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; } -- 2.26.2