aboutsummaryrefslogtreecommitdiff
path: root/drivers/hid
diff options
context:
space:
mode:
authorChristophe JAILLET2018-03-19 21:53:26 +0100
committerJiri Kosina2018-04-26 14:33:35 +0200
commit605f077290a594c75a952ad3b78e53d68c1895ae (patch)
tree7188e316fd6a492f4097faad80ff8a7586bd2bd4 /drivers/hid
parent4d1890531413a19d63cb980fee6d9d3ff86d97ad (diff)
HID: alps: Report an error if we receive invalid data in 't4_read_write_register()'
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>
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/hid-alps.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/hid/hid-alps.c b/drivers/hid/hid-alps.c
index b1eeb4839bfc..925396fdf0d9 100644
--- a/drivers/hid/hid-alps.c
+++ b/drivers/hid/hid-alps.c
@@ -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);