diff options
author | Janne Kanniainen <janne.kanniainen@gmail.com> | 2014-07-03 10:17:08 -0700 |
---|---|---|
committer | Bryan Wu <cooloney@gmail.com> | 2014-07-03 11:12:16 -0700 |
commit | c3883ae918c8754f7c251564d63211e1d5648b08 (patch) | |
tree | d0385ed9577b937f40da7416c238de15ba304954 | |
parent | f471d9480275796dea2ac7ec249b050e70a2888d (diff) | |
download | linux-stable-c3883ae918c8754f7c251564d63211e1d5648b08.tar.gz linux-stable-c3883ae918c8754f7c251564d63211e1d5648b08.tar.bz2 linux-stable-c3883ae918c8754f7c251564d63211e1d5648b08.zip |
HID: gt683r: fix race condition
This will fix race condition noticed by Oliver Neukum. Sysfs files are
created before mutex and work are initialized.
Signed-off-by: Janne Kanniainen <janne.kanniainen@gmail.com>
Reviewed-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
-rw-r--r-- | drivers/hid/hid-gt683r.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/hid/hid-gt683r.c b/drivers/hid/hid-gt683r.c index 077f7a19c9d5..073bd80ec839 100644 --- a/drivers/hid/hid-gt683r.c +++ b/drivers/hid/hid-gt683r.c @@ -227,6 +227,9 @@ static int gt683r_led_probe(struct hid_device *hdev, if (!led) return -ENOMEM; + mutex_init(&led->lock); + INIT_WORK(&led->work, gt683r_led_work); + led->mode = GT683R_LED_NORMAL; led->hdev = hdev; hid_set_drvdata(hdev, led); @@ -271,9 +274,6 @@ static int gt683r_led_probe(struct hid_device *hdev, goto fail; } - mutex_init(&led->lock); - INIT_WORK(&led->work, gt683r_led_work); - return 0; fail: |