diff mbox

HID: roccat: Fixing race condition on initialization

Message ID 1283000268.4789.1.camel@neuromancer (mailing list archive)
State New, archived
Delegated to: Jiri Kosina
Headers show

Commit Message

Stefan Achatz Aug. 28, 2010, 12:57 p.m. UTC
None
diff mbox

Patch

diff --git a/drivers/hid/hid-roccat-kone.c b/drivers/hid/hid-roccat-kone.c
index f776957..cfeab56 100644
--- a/drivers/hid/hid-roccat-kone.c
+++ b/drivers/hid/hid-roccat-kone.c
@@ -966,6 +966,10 @@  static int kone_raw_event(struct hid_device *hdev, struct hid_report *report,
 	struct kone_device *kone = hid_get_drvdata(hdev);
 	struct kone_mouse_event *event = (struct kone_mouse_event *)data;
 
+	/* possible race condition on initialization */
+	if (!kone)
+		return 0;
+
 	/* keyboard events are always processed by default handler */
 	if (size != sizeof(struct kone_mouse_event))
 		return 0;