mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-13 07:44:00 +08:00
Input: edt-ft5x06 - fix access to non-existing register
reg_addr->reg_report_rate is supposed to exist in M06, not M09. The driver is written to skip avoids access to non-existing registers when the register address is NO_REGISTER (0xff). But reg_addr->reg_report_rate is initialized to 0x00 by devm_kzalloc() (in edt_ft5x06_ts_probe()) and not changed thereafter. So the checks do not work and an access to register 0x00 is done. Fix by setting reg_addr->reg_report_rate to NO_REGISTER. Also fix the only place where reg_report_rate is checked against zero instead of NO_REGISTER. Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
This commit is contained in:
parent
4f1b461dd1
commit
4701475282
@ -593,7 +593,7 @@ static int edt_ft5x06_work_mode(struct edt_ft5x06_ts_data *tsdata)
|
||||
tsdata->gain);
|
||||
edt_ft5x06_register_write(tsdata, reg_addr->reg_offset,
|
||||
tsdata->offset);
|
||||
if (reg_addr->reg_report_rate)
|
||||
if (reg_addr->reg_report_rate != NO_REGISTER)
|
||||
edt_ft5x06_register_write(tsdata, reg_addr->reg_report_rate,
|
||||
tsdata->report_rate);
|
||||
|
||||
@ -874,6 +874,7 @@ edt_ft5x06_ts_set_regs(struct edt_ft5x06_ts_data *tsdata)
|
||||
|
||||
case M09:
|
||||
reg_addr->reg_threshold = M09_REGISTER_THRESHOLD;
|
||||
reg_addr->reg_report_rate = NO_REGISTER;
|
||||
reg_addr->reg_gain = M09_REGISTER_GAIN;
|
||||
reg_addr->reg_offset = M09_REGISTER_OFFSET;
|
||||
reg_addr->reg_num_x = M09_REGISTER_NUM_X;
|
||||
|
Loading…
Reference in New Issue
Block a user