From 0770d07f7b33081f68f8d7a291395005d7044c6b Mon Sep 17 00:00:00 2001 From: Jonathan Corbet Date: Fri, 16 Mar 2012 19:14:51 -0300 Subject: [PATCH] [media] marvell-cam: Remove broken "owner" logic The marvell cam driver retained just enough of the owner-tracking logic from cafe_ccic to be broken; it could, conceivably, cause the driver to release DMA memory while the controller is still active. Simply remove the remaining pieces and ensure that the controller is stopped before we free things. Signed-off-by: Jonathan Corbet Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/marvell-ccic/mcam-core.c | 5 +---- drivers/media/video/marvell-ccic/mcam-core.h | 1 - 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/media/video/marvell-ccic/mcam-core.c b/drivers/media/video/marvell-ccic/mcam-core.c index 35cd89d3e676..b26118246763 100644 --- a/drivers/media/video/marvell-ccic/mcam-core.c +++ b/drivers/media/video/marvell-ccic/mcam-core.c @@ -1564,11 +1564,8 @@ static int mcam_v4l_release(struct file *filp) singles, delivered); mutex_lock(&cam->s_mutex); (cam->users)--; - if (filp == cam->owner) { - mcam_ctlr_stop_dma(cam); - cam->owner = NULL; - } if (cam->users == 0) { + mcam_ctlr_stop_dma(cam); mcam_cleanup_vb2(cam); mcam_ctlr_power_down(cam); if (cam->buffer_mode == B_vmalloc && alloc_bufs_at_read) diff --git a/drivers/media/video/marvell-ccic/mcam-core.h b/drivers/media/video/marvell-ccic/mcam-core.h index 917200e63255..bd6acba9fb37 100644 --- a/drivers/media/video/marvell-ccic/mcam-core.h +++ b/drivers/media/video/marvell-ccic/mcam-core.h @@ -107,7 +107,6 @@ struct mcam_camera { enum mcam_state state; unsigned long flags; /* Buffer status, mainly (dev_lock) */ int users; /* How many open FDs */ - struct file *owner; /* Who has data access (v4l2) */ /* * Subsystem structures.