Signed-off-by: Jonathan Corbet <corbet@lwn.net>
struct uio_listener *listener;
int ret = 0;
+ lock_kernel();
idev = idr_find(&uio_idr, iminor(inode));
- if (!idev)
- return -ENODEV;
+ if (!idev) {
+ ret = -ENODEV;
+ goto out;
+ }
- if (!try_module_get(idev->owner))
- return -ENODEV;
+ if (!try_module_get(idev->owner)) {
+ ret = -ENODEV;
+ goto out;
+ }
listener = kmalloc(sizeof(*listener), GFP_KERNEL);
if (!listener) {
if (ret)
goto err_infoopen;
}
-
+ unlock_kernel();
return 0;
err_infoopen:
module_put(idev->owner);
+out:
+ unlock_kernel();
return ret;
}