diff options
author | Janne Kanniainen <janne.kanniainen@gmail.com> | 2014-07-03 13:17:08 -0400 |
---|---|---|
committer | Bryan Wu <cooloney@gmail.com> | 2014-07-03 14:12:16 -0400 |
commit | c3883ae918c8754f7c251564d63211e1d5648b08 (patch) | |
tree | d0385ed9577b937f40da7416c238de15ba304954 | |
parent | f471d9480275796dea2ac7ec249b050e70a2888d (diff) |
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, | |||
227 | if (!led) | 227 | if (!led) |
228 | return -ENOMEM; | 228 | return -ENOMEM; |
229 | 229 | ||
230 | mutex_init(&led->lock); | ||
231 | INIT_WORK(&led->work, gt683r_led_work); | ||
232 | |||
230 | led->mode = GT683R_LED_NORMAL; | 233 | led->mode = GT683R_LED_NORMAL; |
231 | led->hdev = hdev; | 234 | led->hdev = hdev; |
232 | hid_set_drvdata(hdev, led); | 235 | hid_set_drvdata(hdev, led); |
@@ -271,9 +274,6 @@ static int gt683r_led_probe(struct hid_device *hdev, | |||
271 | goto fail; | 274 | goto fail; |
272 | } | 275 | } |
273 | 276 | ||
274 | mutex_init(&led->lock); | ||
275 | INIT_WORK(&led->work, gt683r_led_work); | ||
276 | |||
277 | return 0; | 277 | return 0; |
278 | 278 | ||
279 | fail: | 279 | fail: |