aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-zpff.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hid/hid-zpff.c')
-rw-r--r--drivers/hid/hid-zpff.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/drivers/hid/hid-zpff.c b/drivers/hid/hid-zpff.c
index 6ec28a37c146..a29756c6ca02 100644
--- a/drivers/hid/hid-zpff.c
+++ b/drivers/hid/hid-zpff.c
@@ -68,21 +68,13 @@ static int zpff_init(struct hid_device *hid)
68 struct hid_report *report; 68 struct hid_report *report;
69 struct hid_input *hidinput = list_entry(hid->inputs.next, 69 struct hid_input *hidinput = list_entry(hid->inputs.next,
70 struct hid_input, list); 70 struct hid_input, list);
71 struct list_head *report_list =
72 &hid->report_enum[HID_OUTPUT_REPORT].report_list;
73 struct input_dev *dev = hidinput->input; 71 struct input_dev *dev = hidinput->input;
74 int error; 72 int i, error;
75 73
76 if (list_empty(report_list)) { 74 for (i = 0; i < 4; i++) {
77 hid_err(hid, "no output report found\n"); 75 report = hid_validate_values(hid, HID_OUTPUT_REPORT, 0, i, 1);
78 return -ENODEV; 76 if (!report)
79 } 77 return -ENODEV;
80
81 report = list_entry(report_list->next, struct hid_report, list);
82
83 if (report->maxfield < 4) {
84 hid_err(hid, "not enough fields in report\n");
85 return -ENODEV;
86 } 78 }
87 79
88 zpff = kzalloc(sizeof(struct zpff_device), GFP_KERNEL); 80 zpff = kzalloc(sizeof(struct zpff_device), GFP_KERNEL);