[media] v4l: Make sure we hold a reference to the v4l2_device before using it

v4l2_device_disconnect() calls dev_get_drvdata() and dev_set_drvdata()
on the device it received in v4l2_device_register(). Get a reference to
the device in v4l2_device_register() to make sure it won't disappear as
long as we need it.

Reported-by: Sitsofe Wheeler <sitsofe@yahoo.com>
Signed-off-by: Dave Young <hidave.darkstar@gmail.com>
Tested-by: Sitsofe Wheeler <sitsofe@yahoo.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
1 file changed