lkml.org 
[lkml]   [2018]   [Mar]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/4] HID: alps: Report an error if we receive invalid data in 't4_read_write_register()'
Date
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>
---
Untested
---
drivers/hid/hid-alps.c | 2 ++
1 file changed, 2 insertions(+)

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);
--
2.14.1
\
 
 \ /
  Last update: 2018-03-19 21:55    [W:0.366 / U:0.308 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site