]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
Input: snvs_pwrkey - fix returned value check of syscon_regmap_lookup_by_phandle()
authorVladimir Zapolskiy <vz@mleia.com>
Tue, 8 Mar 2016 19:06:39 +0000 (11:06 -0800)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Sat, 12 Mar 2016 01:53:17 +0000 (17:53 -0800)
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>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/keyboard/snvs_pwrkey.c

index b0ffadeb208c2851f120e986f67532d80fd96783..24a9f599082f7b690b05eba15d3619e5cd0aed74 100644 (file)
@@ -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)) {