diff options
author | Ian Abbott <abbotti@mev.co.uk> | 2013-04-04 14:58:57 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-04-05 14:33:18 -0700 |
commit | dcd7b8bd63cb81c5b973bf86510ca3c80bbbd162 (patch) | |
tree | 04a6965c7bed192adef204499e4661990b4bc770 /drivers/staging/comedi/drivers.c | |
parent | b2a644b435de1d45bd8b5d4e391c894a662eb1f3 (diff) |
staging: comedi: put module _after_ detach
On failure of the call to the low-level comedi device driver's
`->attach()` handler from `__comedi_device_attach()`, reverse the
current ordering of the calls to `module_put()` and
`comedi_device_detach()` because `__comedi_device_detach()` will call
code in the module being put.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/comedi/drivers.c')
-rw-r--r-- | drivers/staging/comedi/drivers.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c index 73727a73bd3..6f232b8128c 100644 --- a/drivers/staging/comedi/drivers.c +++ b/drivers/staging/comedi/drivers.c @@ -396,8 +396,8 @@ int comedi_device_attach(struct comedi_device *dev, struct comedi_devconfig *it) dev->driver = driv; ret = driv->attach(dev, it); if (ret < 0) { - module_put(dev->driver->module); __comedi_device_detach(dev); + module_put(dev->driver->module); return ret; } ret = comedi_device_postconfig(dev); |