Skip to content

Commit

Permalink
Input: elants_i2c - fix division by zero if firmware reports zero phy…
Browse files Browse the repository at this point in the history
…s size

Touchscreen firmware of ASUS Transformer TF700T reports zeros for the phys
size. Hence check whether the size is zero and don't set the resolution in
this case.

Reported-by: Jasper Korten <jja2000@gmail.com>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Link: https://lore.kernel.org/r/20210302100824.3423-1-digetx@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
  • Loading branch information
Dmitry Osipenko authored and Dmitry Torokhov committed Mar 28, 2021
1 parent 69d5ff3 commit 781bab3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/input/touchscreen/elants_i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -1441,7 +1441,7 @@ static int elants_i2c_probe(struct i2c_client *client,

touchscreen_parse_properties(ts->input, true, &ts->prop);

if (ts->chip_id == EKTF3624) {
if (ts->chip_id == EKTF3624 && ts->phy_x && ts->phy_y) {
/* calculate resolution from size */
ts->x_res = DIV_ROUND_CLOSEST(ts->prop.max_x, ts->phy_x);
ts->y_res = DIV_ROUND_CLOSEST(ts->prop.max_y, ts->phy_y);
Expand Down

0 comments on commit 781bab3

Please sign in to comment.