diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2024-09-03 22:59:06 +0200 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2024-09-04 00:01:11 +0200 |
commit | a790df272a20dcc88ffebe20eca34c54f528fcaa (patch) | |
tree | 77c3346eb139a349eb3c1719c8d36f1f62c99ab2 | |
parent | MAINTAINERS: remove unneeded file entry in INPUT section (diff) | |
download | linux-a790df272a20dcc88ffebe20eca34c54f528fcaa.tar.xz linux-a790df272a20dcc88ffebe20eca34c54f528fcaa.zip |
Input: synaptics-rmi4 - fix crash when DPM query is not supported
Stop clobbering "item" variable when checking if the device supports
querying DPM values because its original value is still needed in
case when we need to fall back to the old way of figuring sensor size.
Reported-by: Richard Acayan <mailingradian@gmail.com>
Tested-by: Richard Acayan <mailingradian@gmail.com>
Fixes: 14d650fcb7fb ("Input: synaptics-rmi4 - add support for querying DPM value (F12)")
Link: https://lore.kernel.org/r/ZtdQW7nqAOEJDNBN@radian
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-rw-r--r-- | drivers/input/rmi4/rmi_f12.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/input/rmi4/rmi_f12.c b/drivers/input/rmi4/rmi_f12.c index fc2cc8e2b0ba..8246fe77114b 100644 --- a/drivers/input/rmi4/rmi_f12.c +++ b/drivers/input/rmi4/rmi_f12.c @@ -129,9 +129,8 @@ static int rmi_f12_read_sensor_tuning(struct f12_data *f12) * Use the Query DPM feature when the resolution query register * exists. */ - item = rmi_get_register_desc_item(&f12->query_reg_desc, - RMI_F12_QUERY_RESOLUTION); - if (item) { + if (rmi_get_register_desc_item(&f12->query_reg_desc, + RMI_F12_QUERY_RESOLUTION)) { offset = rmi_register_desc_calc_reg_offset(&f12->query_reg_desc, RMI_F12_QUERY_RESOLUTION); query_dpm_addr = fn->fd.query_base_addr + offset; |