[media] v4l: Reset subdev v4l2_dev field to NULL if registration fails
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Sun, 25 Nov 2012 00:35:48 +0000 (21:35 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sat, 5 Jan 2013 03:25:22 +0000 (01:25 -0200)
commit317efce991620adc589b3005b9baed433dcb2a56
tree606c6efb344bebba61573b965fa537dc44dc428f
parent90271964c96f89862b3e06e184e770e16cca7c8f
[media] v4l: Reset subdev v4l2_dev field to NULL if registration fails

When subdev registration fails the subdev v4l2_dev field is left to a
non-NULL value. Later calls to v4l2_device_unregister_subdev() will
consider the subdev as registered and will module_put() the subdev
module without any matching module_get().
Fix this by setting the subdev v4l2_dev field to NULL in
v4l2_device_register_subdev() when the function fails.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: stable@vger.kernel.org
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/v4l2-core/v4l2-device.c