]> git.karo-electronics.de Git - karo-tx-linux.git/commit
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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 3 Mar 2013 22:03:36 +0000 (06:03 +0800)
commit59af41c9012ea4aeaae5904b5c671aef69762f8f
tree82cbe6cd968fe7896b374abe2e2236035514fabd
parent6afda116f93e0af68ef466304aca0483f5ff87d5
media: v4l: Reset subdev v4l2_dev field to NULL if registration fails

commit 317efce991620adc589b3005b9baed433dcb2a56 upstream.

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>
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/media/v4l2-core/v4l2-device.c