Merge branches 'for-5.1/upstream-fixes', 'for-5.2/core', 'for-5.2/ish', 'for-5.2...
[sfrench/cifs-2.6.git] / drivers / hid / hid-core.c
index 59e95768142dcd461661adb9ccf36b91db1e2226..92387fc0bf180e730d606556b018fe34dd916de6 100644 (file)
@@ -1314,10 +1314,10 @@ static u32 __extract(u8 *report, unsigned offset, int n)
 u32 hid_field_extract(const struct hid_device *hid, u8 *report,
                        unsigned offset, unsigned n)
 {
-       if (n > 32) {
-               hid_warn(hid, "hid_field_extract() called with n (%d) > 32! (%s)\n",
+       if (n > 256) {
+               hid_warn(hid, "hid_field_extract() called with n (%d) > 256! (%s)\n",
                         n, current->comm);
-               n = 32;
+               n = 256;
        }
 
        return __extract(report, offset, n);
@@ -1637,7 +1637,7 @@ static struct hid_report *hid_get_report(struct hid_report_enum *report_enum,
  * Implement a generic .request() callback, using .raw_request()
  * DO NOT USE in hid drivers directly, but through hid_hw_request instead.
  */
-void __hid_request(struct hid_device *hid, struct hid_report *report,
+int __hid_request(struct hid_device *hid, struct hid_report *report,
                int reqtype)
 {
        char *buf;
@@ -1646,7 +1646,7 @@ void __hid_request(struct hid_device *hid, struct hid_report *report,
 
        buf = hid_alloc_report_buf(report, GFP_KERNEL);
        if (!buf)
-               return;
+               return -ENOMEM;
 
        len = hid_report_len(report);
 
@@ -1663,8 +1663,11 @@ void __hid_request(struct hid_device *hid, struct hid_report *report,
        if (reqtype == HID_REQ_GET_REPORT)
                hid_input_report(hid, report->type, buf, ret, 0);
 
+       ret = 0;
+
 out:
        kfree(buf);
+       return ret;
 }
 EXPORT_SYMBOL_GPL(__hid_request);