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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
b2a644b435
commit
dcd7b8bd63
@@ -396,8 +396,8 @@ int comedi_device_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
|||||||
dev->driver = driv;
|
dev->driver = driv;
|
||||||
ret = driv->attach(dev, it);
|
ret = driv->attach(dev, it);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
module_put(dev->driver->module);
|
|
||||||
__comedi_device_detach(dev);
|
__comedi_device_detach(dev);
|
||||||
|
module_put(dev->driver->module);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
ret = comedi_device_postconfig(dev);
|
ret = comedi_device_postconfig(dev);
|
||||||
|
Reference in New Issue
Block a user