Merge branches 'for-3.18/always-poll-quirk', 'for-3.18/logitech', 'for-3.18/picolcd...
[sfrench/cifs-2.6.git] / drivers / hid / hid-thingm.c
index 134be89b15eadd3af92f81ac55e8d4d77790529e..b95d3978c2723ffc9a49a82bf07b2c2a06da0dbf 100644 (file)
@@ -208,10 +208,10 @@ unregister_red:
 
 static void thingm_remove_rgb(struct thingm_rgb *rgb)
 {
 
 static void thingm_remove_rgb(struct thingm_rgb *rgb)
 {
-       flush_work(&rgb->work);
        led_classdev_unregister(&rgb->red.ldev);
        led_classdev_unregister(&rgb->green.ldev);
        led_classdev_unregister(&rgb->blue.ldev);
        led_classdev_unregister(&rgb->red.ldev);
        led_classdev_unregister(&rgb->green.ldev);
        led_classdev_unregister(&rgb->blue.ldev);
+       flush_work(&rgb->work);
 }
 
 static int thingm_probe(struct hid_device *hdev, const struct hid_device_id *id)
 }
 
 static int thingm_probe(struct hid_device *hdev, const struct hid_device_id *id)
@@ -250,6 +250,7 @@ static int thingm_probe(struct hid_device *hdev, const struct hid_device_id *id)
 
        if (!tdev->fwinfo) {
                hid_err(hdev, "unsupported firmware %c\n", tdev->version.major);
 
        if (!tdev->fwinfo) {
                hid_err(hdev, "unsupported firmware %c\n", tdev->version.major);
+               err = -ENODEV;
                goto stop;
        }
 
                goto stop;
        }
 
@@ -286,10 +287,10 @@ static void thingm_remove(struct hid_device *hdev)
        struct thingm_device *tdev = hid_get_drvdata(hdev);
        int i;
 
        struct thingm_device *tdev = hid_get_drvdata(hdev);
        int i;
 
+       hid_hw_stop(hdev);
+
        for (i = 0; i < tdev->fwinfo->numrgb; ++i)
                thingm_remove_rgb(tdev->rgb + i);
        for (i = 0; i < tdev->fwinfo->numrgb; ++i)
                thingm_remove_rgb(tdev->rgb + i);
-
-       hid_hw_stop(hdev);
 }
 
 static const struct hid_device_id thingm_table[] = {
 }
 
 static const struct hid_device_id thingm_table[] = {