HID: hid-input: allow input_configured callback return errors
[sfrench/cifs-2.6.git] / drivers / hid / hid-input.c
index e3c63640df737d5527c6d2609622417a4e03c8d3..2ba6bf69b7d0c45c3ca76b612de5d647d513e3ba 100644 (file)
@@ -1166,8 +1166,11 @@ void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct
 
        input_event(input, usage->type, usage->code, value);
 
-       if ((field->flags & HID_MAIN_ITEM_RELATIVE) && (usage->type == EV_KEY))
+       if ((field->flags & HID_MAIN_ITEM_RELATIVE) &&
+           usage->type == EV_KEY && value) {
+               input_sync(input);
                input_event(input, usage->type, usage->code, 0);
+       }
 }
 
 void hidinput_report_event(struct hid_device *hid, struct hid_report *report)
@@ -1507,8 +1510,9 @@ int hidinput_connect(struct hid_device *hid, unsigned int force)
                                 * UGCI) cram a lot of unrelated inputs into the
                                 * same interface. */
                                hidinput->report = report;
-                               if (drv->input_configured)
-                                       drv->input_configured(hid, hidinput);
+                               if (drv->input_configured &&
+                                   drv->input_configured(hid, hidinput))
+                                       goto out_cleanup;
                                if (input_register_device(hidinput->input))
                                        goto out_cleanup;
                                hidinput = NULL;
@@ -1529,8 +1533,9 @@ int hidinput_connect(struct hid_device *hid, unsigned int force)
        }
 
        if (hidinput) {
-               if (drv->input_configured)
-                       drv->input_configured(hid, hidinput);
+               if (drv->input_configured &&
+                   drv->input_configured(hid, hidinput))
+                       goto out_cleanup;
                if (input_register_device(hidinput->input))
                        goto out_cleanup;
        }