diff options
Diffstat (limited to 'drivers/hid/hid-lgff.c')
-rw-r--r-- | drivers/hid/hid-lgff.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/hid/hid-lgff.c b/drivers/hid/hid-lgff.c index c79a6ec43745..aed4ddc397a9 100644 --- a/drivers/hid/hid-lgff.c +++ b/drivers/hid/hid-lgff.c | |||
@@ -115,12 +115,19 @@ static void hid_lgff_set_autocenter(struct input_dev *dev, u16 magnitude) | |||
115 | 115 | ||
116 | int lgff_init(struct hid_device* hid) | 116 | int lgff_init(struct hid_device* hid) |
117 | { | 117 | { |
118 | struct hid_input *hidinput = list_entry(hid->inputs.next, struct hid_input, list); | 118 | struct hid_input *hidinput; |
119 | struct input_dev *dev = hidinput->input; | 119 | struct input_dev *dev; |
120 | const signed short *ff_bits = ff_joystick; | 120 | const signed short *ff_bits = ff_joystick; |
121 | int error; | 121 | int error; |
122 | int i; | 122 | int i; |
123 | 123 | ||
124 | if (list_empty(&hid->inputs)) { | ||
125 | hid_err(hid, "no inputs found\n"); | ||
126 | return -ENODEV; | ||
127 | } | ||
128 | hidinput = list_entry(hid->inputs.next, struct hid_input, list); | ||
129 | dev = hidinput->input; | ||
130 | |||
124 | /* Check that the report looks ok */ | 131 | /* Check that the report looks ok */ |
125 | if (!hid_validate_values(hid, HID_OUTPUT_REPORT, 0, 0, 7)) | 132 | if (!hid_validate_values(hid, HID_OUTPUT_REPORT, 0, 0, 7)) |
126 | return -ENODEV; | 133 | return -ENODEV; |