]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - drivers/hid/wacom_sys.c
Merge tag 'xfs-5.4-fixes-4' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux
[linux.git] / drivers / hid / wacom_sys.c
index 53bddb50aebaf500f0f5059a9fd2cba56e7b4182..5ded94b7bf684b87359549444c6f1cdddc17bbf2 100644 (file)
@@ -88,7 +88,7 @@ static void wacom_wac_queue_flush(struct hid_device *hdev,
 }
 
 static int wacom_wac_pen_serial_enforce(struct hid_device *hdev,
-               struct hid_report *report, u8 *raw_data, int size)
+               struct hid_report *report, u8 *raw_data, int report_size)
 {
        struct wacom *wacom = hid_get_drvdata(hdev);
        struct wacom_wac *wacom_wac = &wacom->wacom_wac;
@@ -149,7 +149,8 @@ static int wacom_wac_pen_serial_enforce(struct hid_device *hdev,
        if (flush)
                wacom_wac_queue_flush(hdev, &wacom_wac->pen_fifo);
        else if (insert)
-               wacom_wac_queue_insert(hdev, &wacom_wac->pen_fifo, raw_data, size);
+               wacom_wac_queue_insert(hdev, &wacom_wac->pen_fifo,
+                                      raw_data, report_size);
 
        return insert && !flush;
 }
@@ -2176,7 +2177,7 @@ static void wacom_update_name(struct wacom *wacom, const char *suffix)
 {
        struct wacom_wac *wacom_wac = &wacom->wacom_wac;
        struct wacom_features *features = &wacom_wac->features;
-       char name[WACOM_NAME_MAX];
+       char name[WACOM_NAME_MAX - 20]; /* Leave some room for suffixes */
 
        /* Generic devices name unspecified */
        if ((features->type == HID_GENERIC) && !strcmp("Wacom HID", features->name)) {
@@ -2718,14 +2719,12 @@ static int wacom_probe(struct hid_device *hdev,
        wacom_wac->features = *((struct wacom_features *)id->driver_data);
        features = &wacom_wac->features;
 
-       if (features->check_for_hid_type && features->hid_type != hdev->type) {
-               error = -ENODEV;
-               goto fail;
-       }
+       if (features->check_for_hid_type && features->hid_type != hdev->type)
+               return -ENODEV;
 
        error = kfifo_alloc(&wacom_wac->pen_fifo, WACOM_PKGLEN_MAX, GFP_KERNEL);
        if (error)
-               goto fail;
+               return error;
 
        wacom_wac->hid_data.inputmode = -1;
        wacom_wac->mode_report = -1;
@@ -2743,12 +2742,12 @@ static int wacom_probe(struct hid_device *hdev,
        error = hid_parse(hdev);
        if (error) {
                hid_err(hdev, "parse failed\n");
-               goto fail;
+               return error;
        }
 
        error = wacom_parse_and_register(wacom, false);
        if (error)
-               goto fail;
+               return error;
 
        if (hdev->bus == BUS_BLUETOOTH) {
                error = device_create_file(&hdev->dev, &dev_attr_speed);
@@ -2759,10 +2758,6 @@ static int wacom_probe(struct hid_device *hdev,
        }
 
        return 0;
-
-fail:
-       hid_set_drvdata(hdev, NULL);
-       return error;
 }
 
 static void wacom_remove(struct hid_device *hdev)
@@ -2791,8 +2786,6 @@ static void wacom_remove(struct hid_device *hdev)
                wacom_release_resources(wacom);
 
        kfifo_free(&wacom_wac->pen_fifo);
-
-       hid_set_drvdata(hdev, NULL);
 }
 
 #ifdef CONFIG_PM