aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/camera.c
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2016-06-13 15:08:01 +0530
committerGreg Kroah-Hartman <gregkh@google.com>2016-06-13 11:10:09 -0700
commitd9e4c4ee12e490aca06a0a70d534c60648e2f43a (patch)
treefdb4c690c9be2253b92a82997b3b5827f486308f /drivers/staging/greybus/camera.c
parentgreybus: connection: Return bool from gb_connection_intf_find() (diff)
downloadlinux-dev-d9e4c4ee12e490aca06a0a70d534c60648e2f43a.tar.xz
linux-dev-d9e4c4ee12e490aca06a0a70d534c60648e2f43a.zip
greybus: camera: Initialize mutex before using it
We are using the mutex from gb_camera_cleanup(), which can get called even before the mutex is initialized. Fix it by initializing the mutex early enough. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@linaro.org> Reviewed-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/camera.c')
-rw-r--r--drivers/staging/greybus/camera.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/staging/greybus/camera.c b/drivers/staging/greybus/camera.c
index ca1f4989197f..0d20c6b8b015 100644
--- a/drivers/staging/greybus/camera.c
+++ b/drivers/staging/greybus/camera.c
@@ -999,6 +999,7 @@ static int gb_camera_probe(struct gb_bundle *bundle,
return -ENOMEM;
gcam->bundle = bundle;
+ mutex_init(&gcam->mutex);
conn = gb_connection_create(bundle, mgmt_cport_id,
gb_camera_request_handler);
@@ -1014,8 +1015,6 @@ static int gb_camera_probe(struct gb_bundle *bundle,
if (ret)
goto error;
- mutex_init(&gcam->mutex);
-
/*
* Create the data connection between the camera module data CPort and
* APB CDSI1. The CDSI1 CPort ID is hardcoded by the ES2 bridge.