Commit b9c79543 authored by Alexey Khoroshilov's avatar Alexey Khoroshilov Committed by Greg Kroah-Hartman

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: default avatarAlexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent bd83a4ab
...@@ -580,6 +580,7 @@ static int mei_cl_device_probe(struct device *dev) ...@@ -580,6 +580,7 @@ static int mei_cl_device_probe(struct device *dev)
struct mei_cl_device *cldev; struct mei_cl_device *cldev;
struct mei_cl_driver *cldrv; struct mei_cl_driver *cldrv;
const struct mei_cl_device_id *id; const struct mei_cl_device_id *id;
int ret;
cldev = to_mei_cl_device(dev); cldev = to_mei_cl_device(dev);
cldrv = to_mei_cl_driver(dev->driver); cldrv = to_mei_cl_driver(dev->driver);
...@@ -594,9 +595,12 @@ static int mei_cl_device_probe(struct device *dev) ...@@ -594,9 +595,12 @@ static int mei_cl_device_probe(struct device *dev)
if (!id) if (!id)
return -ENODEV; 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;
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment