Skip to content

Commit

Permalink
HID: alps: Report an error if we receive invalid data in 't4_read_wri…
Browse files Browse the repository at this point in the history
…te_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: 73196eb ("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>
  • Loading branch information
Christophe JAILLET authored and Jiri Kosina committed Apr 26, 2018
1 parent 4d18905 commit 605f077
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/hid/hid-alps.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 605f077

Please sign in to comment.