RE: [PATCH 1/3] staging: comedi: amplc_dio200_common: prevent extra free_irq()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Friday, July 25, 2014 10:07 AM, Ian Abbott wrote:
> `dio200_detach()` in "amplc_dio200.c" calls
> `amplc_dio200_common_detach()` in "amplc_dio200_common.c", followed by
> `comedi_legacy_detach()` in "../drivers.c".  Both of those functions
> call `free_irq()` if `dev->irq` is non-zero.  The second call produces a
> warning message because the handler has already been freed.  Prevent
> that by setting `dev->irq = 0` in `amplc_dio200_common_detach()`.
>
> Signed-off-by: Ian Abbott <abbotti@xxxxxxxxx>
> ---
>  drivers/staging/comedi/drivers/amplc_dio200_common.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/staging/comedi/drivers/amplc_dio200_common.c b/drivers/staging/comedi/drivers/amplc_dio200_common.c
> index 78700e8..3592e58 100644
> --- a/drivers/staging/comedi/drivers/amplc_dio200_common.c
> +++ b/drivers/staging/comedi/drivers/amplc_dio200_common.c
> @@ -1202,8 +1202,10 @@ void amplc_dio200_common_detach(struct comedi_device *dev)
>  
>  	if (!thisboard || !devpriv)
>  		return;
> -	if (dev->irq)
> +	if (dev->irq) {
>  		free_irq(dev->irq, dev);
> +		dev->irq = 0;
> +	}
>  }
>  EXPORT_SYMBOL_GPL(amplc_dio200_common_detach);
 
Ian,

I have already gave a Reviewed-by signoff for this series.

After looking over the code I think a cleaner solution would be to:

1) Use comedi_legacy_detach() directly for the (*detach) in the
   legacy ISA driver.
2) Move the code from amplc_dio200_common_detach() into the
   (*detach) function for the PCI driver.
3) Remove the exported function amplc_dio200_common_detach().

Regards,
Hartley

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux