diff options
author | Alexey Khoroshilov <khoroshilov@ispras.ru> | 2016-04-01 22:53:01 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-04-30 23:08:08 +0200 |
commit | b9c79543efcd0235d2fc1485c31ec9e9584f3ad7 (patch) | |
tree | 5446ba70594fa21d2b8b7509e2ea9541cc8783ea /drivers/misc | |
parent | char: xillybus: use devm_add_action_or_reset (diff) | |
download | linux-b9c79543efcd0235d2fc1485c31ec9e9584f3ad7.tar.xz linux-b9c79543efcd0235d2fc1485c31ec9e9584f3ad7.zip |
mei: do not pin module if cldrv->probe() failed
If cldrv->probe() failed in mei_cl_device_probe(),
the mei module is left pinned.
The patch moves __module_get(THIS_MODULE) after cldrv->probe().
Found by Linux Driver Verification project (linuxtesting.org).
Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r-- | drivers/misc/mei/bus.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/misc/mei/bus.c b/drivers/misc/mei/bus.c index 04dc05150898..bc13f5f35a19 100644 --- a/drivers/misc/mei/bus.c +++ b/drivers/misc/mei/bus.c @@ -580,6 +580,7 @@ static int mei_cl_device_probe(struct device *dev) struct mei_cl_device *cldev; struct mei_cl_driver *cldrv; const struct mei_cl_device_id *id; + int ret; cldev = to_mei_cl_device(dev); cldrv = to_mei_cl_driver(dev->driver); @@ -594,9 +595,12 @@ static int mei_cl_device_probe(struct device *dev) if (!id) return -ENODEV; - __module_get(THIS_MODULE); + ret = cldrv->probe(cldev, id); + if (ret) + return ret; - return cldrv->probe(cldev, id); + __module_get(THIS_MODULE); + return 0; } /** |