mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
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 <[email protected]> Reviewed-by: Johan Hovold <[email protected]> Signed-off-by: Bryan Wu <[email protected]>
This commit is contained in:
parent
f471d94802
commit
c3883ae918
1 changed files with 3 additions and 3 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Reference in a new issue