aboutsummaryrefslogtreecommitdiff
path: root/drivers/media/video/gspca/conex.c
diff options
context:
space:
mode:
authorJean-Francois Moine <moinejf@free.fr>2008-11-18 06:33:08 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-11-24 12:01:07 -0200
commit98522a7be97f2b23451342e36c39f412f0461e24 (patch)
tree49da3f3aa6d3b2ffc2cd6143cbcbd79de3b7be51 /drivers/media/video/gspca/conex.c
parent818a557eeb9c16a9a2dc93df348b0ff68fbc487f (diff)
V4L/DVB (9689): gspca: Memory leak when disconnect while streaming.
As a side effect, the sd routine stop0 is called on disconnect. This permits the subdriver to free its resources. Signed-off-by: Jean-Francois Moine <moinejf@free.fr> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/gspca/conex.c')
-rw-r--r--drivers/media/video/gspca/conex.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/media/video/gspca/conex.c b/drivers/media/video/gspca/conex.c
index a9d51ba7c57..de28354ea5b 100644
--- a/drivers/media/video/gspca/conex.c
+++ b/drivers/media/video/gspca/conex.c
@@ -846,10 +846,13 @@ static int sd_start(struct gspca_dev *gspca_dev)
return 0;
}
+/* called on streamoff with alt 0 and on disconnect */
static void sd_stop0(struct gspca_dev *gspca_dev)
{
int retry = 50;
+ if (!gspca_dev->present)
+ return;
reg_w_val(gspca_dev, 0x0000, 0x00);
reg_r(gspca_dev, 0x0002, 1);
reg_w_val(gspca_dev, 0x0053, 0x00);