Commit a790df27 authored by Dmitry Torokhov's avatar Dmitry Torokhov

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: default avatarRichard Acayan <mailingradian@gmail.com>
Tested-by: default avatarRichard Acayan <mailingradian@gmail.com>
Fixes: 14d650fc ("Input: synaptics-rmi4 - add support for querying DPM value (F12)")
Link: https://lore.kernel.org/r/ZtdQW7nqAOEJDNBN@radianSigned-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent 8f5ea129
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment