All is said in the subject and below.
These patches are untested. Especially, patch 1 slightly changes the behavior
of 't4_read_write_register()'.
This looks logical to me, but please, review it carefully.
Christophe JAILLET (4):
HID: alps: Report an error if we receive invalid data in
't4_read_write_register()'
HID: alps: Save a memory allocation in 't4_read_write_register()' when
writing data
HID: alps: Check errors returned by 't4_read_write_register()'
HID: alps: Fix some style in 't4_read_write_register()'
drivers/hid/hid-alps.c | 27 ++++++++++++++++++++++-----
1 file changed, 22 insertions(+), 5 deletions(-)
--
2.14.1
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 <redacted>
---
Untested
---
drivers/hid/hid-alps.c | 2 ++
1 file changed, 2 insertions(+)
if 'read_flag' is false, there is no need to allocate and free memory.
We can simply avoid the memory allocation and pass NULL to kfree.
Signed-off-by: Christophe JAILLET <redacted>
---
drivers/hid/hid-alps.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
If only the first 't4_read_write_register()' call fails, the error code
will be overwritten and lost.
Directly report the error instead.
While at it, log some errors if 't4_read_write_register()' fails, as done
in the rest of the driver.
Signed-off-by: Christophe JAILLET <redacted>
---
drivers/hid/hid-alps.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
All is said in the subject and below.
These patches are untested. Especially, patch 1 slightly changes the behavior
of 't4_read_write_register()'.
This looks logical to me, but please, review it carefully.
Christophe JAILLET (4):
HID: alps: Report an error if we receive invalid data in
't4_read_write_register()'
HID: alps: Save a memory allocation in 't4_read_write_register()' when
writing data
HID: alps: Check errors returned by 't4_read_write_register()'
HID: alps: Fix some style in 't4_read_write_register()'
drivers/hid/hid-alps.c | 27 ++++++++++++++++++++++-----
1 file changed, 22 insertions(+), 5 deletions(-)
Masaki-san,
do you have any comments to Christophe's patchset please?
Thanks,
--
Jiri Kosina
SUSE Labs
These patches are untested. Especially, patch 1 slightly changes the behavior
of 't4_read_write_register()'.
This looks logical to me, but please, review it carefully.
Christophe JAILLET (4):
HID: alps: Report an error if we receive invalid data in
't4_read_write_register()'
HID: alps: Save a memory allocation in 't4_read_write_register()' when
writing data
HID: alps: Check errors returned by 't4_read_write_register()'
HID: alps: Fix some style in 't4_read_write_register()'
drivers/hid/hid-alps.c | 27 ++++++++++++++++++++++-----
1 file changed, 22 insertions(+), 5 deletions(-)
Masaki-san,
do you have any comments to Christophe's patchset please?
If there is no feedback, I'll queue the set for 4.18.
Thanks,
--
Jiri Kosina
SUSE Labs
All is said in the subject and below.
These patches are untested. Especially, patch 1 slightly changes the behavior
of 't4_read_write_register()'.
This looks logical to me, but please, review it carefully.
Christophe JAILLET (4):
HID: alps: Report an error if we receive invalid data in
't4_read_write_register()'
HID: alps: Save a memory allocation in 't4_read_write_register()' when
writing data
HID: alps: Check errors returned by 't4_read_write_register()'
HID: alps: Fix some style in 't4_read_write_register()'
drivers/hid/hid-alps.c | 27 ++++++++++++++++++++++-----
1 file changed, 22 insertions(+), 5 deletions(-)