diff mbox series

input: auo_pixcir_ts - add missing check for gpio

Message ID 20201221161239.5346-1-radim.pavlik@tbs-biometrics.com (mailing list archive)
State Superseded
Headers show
Series input: auo_pixcir_ts - add missing check for gpio | expand

Commit Message

Radim Pavlik Dec. 21, 2020, 4:12 p.m. UTC
The of_get_gpio() may return error, so check it immediately. The old
code might fail with EPROBE_DEFER which was masked by the
folowing gpio_is_valid() and returned EINVAL.

Signed-off-by: Radim Pavlik <radim.pavlik@tbs-biometrics.com>
---
 drivers/input/touchscreen/auo-pixcir-ts.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/drivers/input/touchscreen/auo-pixcir-ts.c b/drivers/input/touchscreen/auo-pixcir-ts.c
index c33e63ca6142..8f3cfd743bdd 100644
--- a/drivers/input/touchscreen/auo-pixcir-ts.c
+++ b/drivers/input/touchscreen/auo-pixcir-ts.c
@@ -479,12 +479,16 @@  static struct auo_pixcir_ts_platdata *auo_pixcir_parse_dt(struct device *dev)
 		return ERR_PTR(-ENOMEM);
 
 	pdata->gpio_int = of_get_gpio(np, 0);
+	if (pdata->gpio_int < 0)
+		return ERR_PTR(pdata->gpio_int);
 	if (!gpio_is_valid(pdata->gpio_int)) {
 		dev_err(dev, "failed to get interrupt gpio\n");
 		return ERR_PTR(-EINVAL);
 	}
 
 	pdata->gpio_rst = of_get_gpio(np, 1);
+	if (pdata->gpio_rst < 0)
+		return ERR_PTR(pdata->gpio_rst);
 	if (!gpio_is_valid(pdata->gpio_rst)) {
 		dev_err(dev, "failed to get reset gpio\n");
 		return ERR_PTR(-EINVAL);