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>
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);
goto fail;
}
- mutex_init(&led->lock);
- INIT_WORK(&led->work, gt683r_led_work);
-
return 0;
fail: