summaryrefslogtreecommitdiff
path: root/drivers/staging/greybus/light.c
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2016-06-29 13:42:26 -0700
committerGreg Kroah-Hartman <gregkh@google.com>2016-06-29 16:37:17 -0700
commit957ccca08a990888e2a8f057dee646b8f37b1660 (patch)
treee2bdd81111e008fedd259ff138b0421906c20b7e /drivers/staging/greybus/light.c
parent2aae92bdc25325cfd782cc76842a4302540958f2 (diff)
greybus: light: Initialize mutex before using it
Light protocol driver is suffering from the same issue that was fixed in camera driver earlier (commit a7c3b0c3c8da). Big cleanup function is used instead of fine grained control in the error path, and in one of the cases the mutex was found uninitialized and so the oops seen in SW-6752. Initialize the mutex before any code can access it. Compile tested only. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Rui Miguel Silva <rui.silva@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/light.c')
-rw-r--r--drivers/staging/greybus/light.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/staging/greybus/light.c b/drivers/staging/greybus/light.c
index 78fb8a9f6a48..3d42a5dafee9 100644
--- a/drivers/staging/greybus/light.c
+++ b/drivers/staging/greybus/light.c
@@ -1221,6 +1221,8 @@ static int gb_lights_probe(struct gb_bundle *bundle,
if (!glights)
return -ENOMEM;
+ mutex_init(&glights->lights_lock);
+
connection = gb_connection_create(bundle, le16_to_cpu(cport_desc->id),
gb_lights_request_handler);
if (IS_ERR(connection)) {
@@ -1231,8 +1233,6 @@ static int gb_lights_probe(struct gb_bundle *bundle,
glights->connection = connection;
gb_connection_set_data(connection, glights);
- mutex_init(&glights->lights_lock);
-
greybus_set_drvdata(bundle, glights);
/* We aren't ready to receive an incoming request yet */