v4l2_ctrl_handler_free() and v4l2_device_unregister() are currently only called
when the last user closes the device and the device is already disconnected.
But that's wrong, we need to call these functions whenever the em28xx-v4l
extension is closed and we can already do this if the device is still opened
by some users.
Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
dev->clk = NULL;
}
+ v4l2_ctrl_handler_free(&dev->ctrl_handler);
+ v4l2_device_unregister(&dev->v4l2_dev);
+
if (dev->users)
- em28xx_warn("Device is open ! Deregistration and memory deallocation are deferred on close.\n");
+ em28xx_warn("Device is open ! Memory deallocation is deferred on last close.\n");
return 0;
}
if (dev->disconnected) {
em28xx_release_resources(dev);
- v4l2_ctrl_handler_free(&dev->ctrl_handler);
- v4l2_device_unregister(&dev->v4l2_dev);
kfree(dev->alt_max_pkt_size_isoc);
goto exit;
}