[PATCH] USB: hidinput_hid_event() oops fix
authorPete Zaitcev <zaitcev@redhat.com>
Fri, 29 Jul 2005 19:18:34 +0000 (12:18 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 29 Jul 2005 20:12:54 +0000 (13:12 -0700)
It seems that I see a bug in hidinput_hid_event.  The check for NULL can never
work, becaue &hidinput->input is nonzero at all times.

Cc: <vojtech@suse.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/usb/input/hid-input.c

index e071c8eecceea96a64ab2ccb927f9b896e0922e5..63a4db721f7e5d2e3507b29e76d81c60491ab7c7 100644 (file)
@@ -398,11 +398,12 @@ ignore:
 
 void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct hid_usage *usage, __s32 value, struct pt_regs *regs)
 {
-       struct input_dev *input = &field->hidinput->input;
+       struct input_dev *input;
        int *quirks = &hid->quirks;
 
-       if (!input)
+       if (!field->hidinput)
                return;
+       input = &field->hidinput->input;
 
        input_regs(input, regs);