Commit bdc73d21cb31cfd1e8091de95798fee65bf72e1d

Authored by Franklin S Cooper Jr
Committed by Sekhar Nori
1 parent 9ee01f01ea

Input: edt-ft5x06 - do not call desc_to_gpio for invalid gpios

Since reset and wake pin are optional the gpio structure for those
pins may be null. Therefore, they can't be blindly passed to
desc_to_gpio.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>

Showing 1 changed file with 3 additions and 2 deletions Side-by-side Diff

drivers/input/touchscreen/edt-ft5x06.c
... ... @@ -1032,8 +1032,9 @@
1032 1032  
1033 1033 dev_dbg(&client->dev,
1034 1034 "EDT FT5x06 initialized: IRQ %d, WAKE pin %d, Reset pin %d.\n",
1035   - client->irq, desc_to_gpio(tsdata->wake_pin),
1036   - desc_to_gpio(tsdata->reset_pin));
  1035 + client->irq,
  1036 + tsdata->wake_pin ? desc_to_gpio(tsdata->wake_pin) : -1,
  1037 + tsdata->reset_pin ? desc_to_gpio(tsdata->reset_pin) : -1);
1037 1038  
1038 1039 return 0;
1039 1040