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>
This commit is contained in:
Alexey Khoroshilov 2016-04-01 23:53:01 +03:00 committed by Greg Kroah-Hartman
parent bd83a4ab56
commit b9c79543ef
1 changed files with 6 additions and 2 deletions

View File

@ -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;
}
/**