1

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: 14d650fcb7 ("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>
This commit is contained in:
Dmitry Torokhov 2024-09-03 13:59:06 -07:00
parent 8f5ea12942
commit a790df272a

View File

@ -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;