Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c3883ae9 authored by Janne Kanniainen's avatar Janne Kanniainen Committed by Bryan Wu
Browse files

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: default avatarJanne Kanniainen <janne.kanniainen@gmail.com>
Reviewed-by: default avatarJohan Hovold <johan@kernel.org>
Signed-off-by: default avatarBryan Wu <cooloney@gmail.com>
parent f471d948
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -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: