* [PATCH] input: auo_pixcir_ts - add missing check for gpio
@ 2020-12-21 16:12 Radim Pavlik
0 siblings, 0 replies; 3+ messages in thread
From: Radim Pavlik @ 2020-12-21 16:12 UTC (permalink / raw)
To: dmitry.torokhov; +Cc: linux-input, linux-kernel, Radim Pavlik
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 --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);
--
2.29.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] input: auo_pixcir_ts - add missing check for gpio
2021-01-07 9:32 Radim Pavlik
@ 2021-01-12 5:08 ` Dmitry Torokhov
0 siblings, 0 replies; 3+ messages in thread
From: Dmitry Torokhov @ 2021-01-12 5:08 UTC (permalink / raw)
To: Radim Pavlik; +Cc: linux-input, linux-kernel, Heiko Stuebner
Hi Radim,
On Thu, Jan 07, 2021 at 10:32:17AM +0100, Radim Pavlik wrote:
> 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 --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);
Hmm, while this check might make sense it definitely renders the next
one unnecessary.
BTW, do you have a device that uses this touch panel? This driver could
use more improvements, such as switching to gpiod API and generic device
properties, and dropping the platform data support.
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] input: auo_pixcir_ts - add missing check for gpio
@ 2021-01-07 9:32 Radim Pavlik
2021-01-12 5:08 ` Dmitry Torokhov
0 siblings, 1 reply; 3+ messages in thread
From: Radim Pavlik @ 2021-01-07 9:32 UTC (permalink / raw)
To: dmitry.torokhov; +Cc: linux-input, linux-kernel, Radim Pavlik
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 --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);
--
2.29.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-01-12 5:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-21 16:12 [PATCH] input: auo_pixcir_ts - add missing check for gpio Radim Pavlik
2021-01-07 9:32 Radim Pavlik
2021-01-12 5:08 ` Dmitry Torokhov
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.