staging: comedi: das16: fix das16_detach()
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Mon, 29 Jul 2013 21:07:10 +0000 (14:07 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 1 Aug 2013 00:38:07 +0000 (17:38 -0700)
commitcb09d912e29605bc5a7bc6a204dda8c8f01cf10d
tree3bb83d531561aba7fd2fc199e86240c0aa82ad24
parentefb623168225ee2f49b607d5aaca15caed20e8e4
staging: comedi: das16: fix das16_detach()

The function das16_reset() needs a valid dev->iobase. Since the iobase
is requested after the devpriv has been allocated in the attach, move
the das16_reset() call into the if (devpriv) and add a if (dev->iobase).

Also, move the release of the extra iobase into the if (devpriv) to
prevent an invalid memory access.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/das16.c