diff options
author | Liu Ying <b17645@freescale.com> | 2010-10-25 14:01:28 +0800 |
---|---|---|
committer | Lily Zhang <r58066@freescale.com> | 2010-10-27 15:56:01 +0800 |
commit | 0e8faf19beac04e3041452a9675936cbd3a27e3e (patch) | |
tree | 8bf6809d0d6841959e160d47974206909654bc83 | |
parent | c9b59e3d9fea9ae9932bf73bd57e4557303e10b6 (diff) |
ENGR00132882 MXC V4L2 capture:Check slave is present when open dev
This patch makes sure that slave device is present when opening
related video device. It will avoid a kernel dump if slave device
is not present before calling custom open function.
Signed-off-by: Liu Ying <b17645@freescale.com>
(cherry picked from commit 29f466a69e5ec6ac3253936c9f3f25004f7aff19)
-rw-r--r-- | drivers/media/video/mxc/capture/mxc_v4l2_capture.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/media/video/mxc/capture/mxc_v4l2_capture.c b/drivers/media/video/mxc/capture/mxc_v4l2_capture.c index 56cc875d2da8..308f949d44ad 100644 --- a/drivers/media/video/mxc/capture/mxc_v4l2_capture.c +++ b/drivers/media/video/mxc/capture/mxc_v4l2_capture.c @@ -1374,6 +1374,12 @@ static int mxc_v4l_open(struct file *file) return -EBADF; } + if (cam->sensor == NULL || + cam->sensor->type != v4l2_int_type_slave) { + pr_err("ERROR: v4l2 capture: slave not found!\n"); + return -EAGAIN; + } + down(&cam->busy_lock); err = 0; if (signal_pending(current)) |