]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
HID: sony: Perform duplicate device check earlier on
authorRoderick Colenbrander <roderick.colenbrander@sony.com>
Tue, 7 Mar 2017 23:45:11 +0000 (15:45 -0800)
committerJiri Kosina <jkosina@suse.cz>
Tue, 21 Mar 2017 14:12:07 +0000 (15:12 +0100)
Game controllers can be connected twice through USB and BT. Only
one connection is allowed. Currently we perform a check for duplicate
controllers halfway through device initialization. To prevent
'transient' devices, we should do this check as early as we can.

Signed-off-by: Roderick Colenbrander <roderick.colenbrander@sony.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hid-sony.c

index d8a13081701f0a4662b500ec9f7b23c58fe3246f..5eb5ac922c09087c26f9efb4ed33dffe5afdce0c 100644 (file)
@@ -2477,6 +2477,10 @@ static int sony_input_configured(struct hid_device *hdev,
                goto err_stop;
        }
 
+       ret = append_dev_id = sony_check_add(sc);
+       if (ret < 0)
+               goto err_stop;
+
        ret = sony_allocate_output_report(sc);
        if (ret < 0) {
                hid_err(hdev, "failed to allocate the output report buffer\n");
@@ -2610,10 +2614,6 @@ static int sony_input_configured(struct hid_device *hdev,
                ret = 0;
        }
 
-       if (ret < 0)
-               goto err_stop;
-
-       ret = append_dev_id = sony_check_add(sc);
        if (ret < 0)
                goto err_stop;