* [PATCH] input: snvs_pwrkey: fix returned value check of syscon_regmap_lookup_by_phandle()
@ 2016-03-08 16:51 Vladimir Zapolskiy
2016-03-08 19:06 ` Dmitry Torokhov
0 siblings, 1 reply; 2+ messages in thread
From: Vladimir Zapolskiy @ 2016-03-08 16:51 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: Shawn Guo, linux-input
On error syscon_regmap_lookup_by_phandle() returns ERR_PTR() value,
which makes a check for NULL invalid and may lead to oops on error
path.
Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
---
drivers/input/keyboard/snvs_pwrkey.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/input/keyboard/snvs_pwrkey.c b/drivers/input/keyboard/snvs_pwrkey.c
index 9adf13a..9e92206 100644
--- a/drivers/input/keyboard/snvs_pwrkey.c
+++ b/drivers/input/keyboard/snvs_pwrkey.c
@@ -111,9 +111,9 @@ static int imx_snvs_pwrkey_probe(struct platform_device *pdev)
return -ENOMEM;
pdata->snvs = syscon_regmap_lookup_by_phandle(np, "regmap");
- if (!pdata->snvs) {
+ if (IS_ERR(pdata->snvs)) {
dev_err(&pdev->dev, "Can't get snvs syscon\n");
- return -ENODEV;
+ return PTR_ERR(pdata->snvs);
}
if (of_property_read_u32(np, "linux,keycode", &pdata->keycode)) {
--
2.1.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] input: snvs_pwrkey: fix returned value check of syscon_regmap_lookup_by_phandle()
2016-03-08 16:51 [PATCH] input: snvs_pwrkey: fix returned value check of syscon_regmap_lookup_by_phandle() Vladimir Zapolskiy
@ 2016-03-08 19:06 ` Dmitry Torokhov
0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Torokhov @ 2016-03-08 19:06 UTC (permalink / raw)
To: Vladimir Zapolskiy; +Cc: Shawn Guo, linux-input
On Tue, Mar 08, 2016 at 06:51:04PM +0200, Vladimir Zapolskiy wrote:
> On error syscon_regmap_lookup_by_phandle() returns ERR_PTR() value,
> which makes a check for NULL invalid and may lead to oops on error
> path.
>
> Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Applied, thank you.
> ---
> drivers/input/keyboard/snvs_pwrkey.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/input/keyboard/snvs_pwrkey.c b/drivers/input/keyboard/snvs_pwrkey.c
> index 9adf13a..9e92206 100644
> --- a/drivers/input/keyboard/snvs_pwrkey.c
> +++ b/drivers/input/keyboard/snvs_pwrkey.c
> @@ -111,9 +111,9 @@ static int imx_snvs_pwrkey_probe(struct platform_device *pdev)
> return -ENOMEM;
>
> pdata->snvs = syscon_regmap_lookup_by_phandle(np, "regmap");
> - if (!pdata->snvs) {
> + if (IS_ERR(pdata->snvs)) {
> dev_err(&pdev->dev, "Can't get snvs syscon\n");
> - return -ENODEV;
> + return PTR_ERR(pdata->snvs);
> }
>
> if (of_property_read_u32(np, "linux,keycode", &pdata->keycode)) {
> --
> 2.1.4
>
--
Dmitry
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-03-08 19:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-08 16:51 [PATCH] input: snvs_pwrkey: fix returned value check of syscon_regmap_lookup_by_phandle() Vladimir Zapolskiy
2016-03-08 19:06 ` 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.