]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
HID: alps: Report an error if we receive invalid data in 't4_read_write_register()'
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Mon, 19 Mar 2018 20:53:26 +0000 (21:53 +0100)
committerJiri Kosina <jkosina@suse.cz>
Thu, 26 Apr 2018 12:33:35 +0000 (14:33 +0200)
If the data received is not what is expected, we should return an error.

Otherwise, we return 0 or a positive value which will be interpreted as
success, but '*read_val' has not been updated.

Fixes: 73196ebe134d ("HID: alps: add support for Alps T4 Touchpad device")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hid-alps.c

index b1eeb4839bfc8f4747a1610077fda3ae6c7e77a7..925396fdf0d9ed9a0a1f46c20d8c3a5e19c6bcdd 100644 (file)
@@ -219,6 +219,8 @@ static int t4_read_write_register(struct hid_device *hdev, u32 address,
                        goto exit_readbuf;
                }
 
+               ret = -EINVAL;
+
                if (*(u32 *)&readbuf[6] != address) {
                        dev_err(&hdev->dev, "read register address error (%x,%x)\n",
                        *(u32 *)&readbuf[6], address);