Input: synaptics-rmi4 - fix maximum size check for F12 control register 8
According to the RMI4 spec the maximum size of F12 control register 8 is 15 bytes. The current code incorrectly reports an error if control 8 is greater then 14. Making sensors with a control register 8 with 15 bytes unusable. Signed-off-by: Andrew Duggan <aduggan@synaptics.com> Reported-by: Chris Healy <cphealy@gmail.com> Cc: stable@vger.kernel.org Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
This commit is contained in:
parent
6a5029e664
commit
e4add7b6be
|
@ -66,7 +66,7 @@ static int rmi_f12_read_sensor_tuning(struct f12_data *f12)
|
||||||
struct rmi_device *rmi_dev = fn->rmi_dev;
|
struct rmi_device *rmi_dev = fn->rmi_dev;
|
||||||
int ret;
|
int ret;
|
||||||
int offset;
|
int offset;
|
||||||
u8 buf[14];
|
u8 buf[15];
|
||||||
int pitch_x = 0;
|
int pitch_x = 0;
|
||||||
int pitch_y = 0;
|
int pitch_y = 0;
|
||||||
int clip_x_low = 0;
|
int clip_x_low = 0;
|
||||||
|
@ -86,9 +86,10 @@ static int rmi_f12_read_sensor_tuning(struct f12_data *f12)
|
||||||
|
|
||||||
offset = rmi_register_desc_calc_reg_offset(&f12->control_reg_desc, 8);
|
offset = rmi_register_desc_calc_reg_offset(&f12->control_reg_desc, 8);
|
||||||
|
|
||||||
if (item->reg_size > 14) {
|
if (item->reg_size > sizeof(buf)) {
|
||||||
dev_err(&fn->dev, "F12 control8 should be 14 bytes, not: %ld\n",
|
dev_err(&fn->dev,
|
||||||
item->reg_size);
|
"F12 control8 should be no bigger than %zd bytes, not: %ld\n",
|
||||||
|
sizeof(buf), item->reg_size);
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue