summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2011-04-30 10:34:05 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-05-04 16:22:39 -0300
commitb7534f002d3c81d18abfbf57179d07d3ec763bb5 (patch)
tree9f810491999867006069483cef9a7c98f6c257f2
parentb730011061e2805a46b7291e708b6caaf2be6869 (diff)
downloadlinux-b7534f002d3c81d18abfbf57179d07d3ec763bb5.tar.gz
linux-b7534f002d3c81d18abfbf57179d07d3ec763bb5.tar.bz2
linux-b7534f002d3c81d18abfbf57179d07d3ec763bb5.zip
[media] v4l: Release module if subdev registration fails
If v4l2_device_register_subdev() fails, the reference to the subdev module taken by the function isn't released. Fix this. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Cc: stable@kernel.org Acked-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/video/v4l2-device.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/media/video/v4l2-device.c b/drivers/media/video/v4l2-device.c
index 5aeaf876ba9b..4aae501f02d0 100644
--- a/drivers/media/video/v4l2-device.c
+++ b/drivers/media/video/v4l2-device.c
@@ -155,8 +155,10 @@ int v4l2_device_register_subdev(struct v4l2_device *v4l2_dev,
sd->v4l2_dev = v4l2_dev;
if (sd->internal_ops && sd->internal_ops->registered) {
err = sd->internal_ops->registered(sd);
- if (err)
+ if (err) {
+ module_put(sd->owner);
return err;
+ }
}
/* This just returns 0 if either of the two args is NULL */
@@ -164,6 +166,7 @@ int v4l2_device_register_subdev(struct v4l2_device *v4l2_dev,
if (err) {
if (sd->internal_ops && sd->internal_ops->unregistered)
sd->internal_ops->unregistered(sd);
+ module_put(sd->owner);
return err;
}