public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [V4L2]decrement struct v4l2_device refcount on device urnegister
@ 2011-08-29 20:17 Maciej Szmigiero
  0 siblings, 0 replies; only message in thread
From: Maciej Szmigiero @ 2011-08-29 20:17 UTC (permalink / raw)
  To: Guennadi Liakhovetski, Mauro Carvalho Chehab, linux-media,
	linux-kernel

commit bedf8bcf6b4f90a6e31add3721a2e71877289381 introduced reference counting
for struct v4l2_device.

In v4l2_device_register() a call to kref_init() initializes reference count to 1,
but in v4l2_device_unregister() there is no corresponding decrement.

End result is that reference count never reaches zero and v4l2_device_release()
is never called, not even on videodev module unload.

Fix this by adding reference counter decrement to v4l2_device_unregister().

Signed-off-by: Maciej Szmigiero <mhej@o2.pl>

diff --git a/drivers/media/video/v4l2-device.c b/drivers/media/video/v4l2-device.c

index c72856c..eb39af9 100644

--- a/drivers/media/video/v4l2-device.c

+++ b/drivers/media/video/v4l2-device.c

@@ -131,6 +131,8 @@ void v4l2_device_unregister(struct v4l2_device *v4l2_dev)

         }

 #endif

     }

+

+    v4l2_device_put(v4l2_dev);

 }

 EXPORT_SYMBOL_GPL(v4l2_device_unregister);

 


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-08-29 20:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-29 20:17 [V4L2]decrement struct v4l2_device refcount on device urnegister Maciej Szmigiero

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox