提交 605f0772 编写于 作者: C Christophe JAILLET 提交者: Jiri Kosina

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: 73196ebe ("HID: alps: add support for Alps T4 Touchpad device")
Signed-off-by: NChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: NJiri Kosina <jkosina@suse.cz>
上级 4d189053
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册