Skip to content

Commit 9979c1c

Browse files
vzapolskiydtor
authored andcommitted
Input: snvs_pwrkey - fix returned value check of syscon_regmap_lookup_by_phandle()
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 <[email protected]> Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent 62d5bdf commit 9979c1c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/input/keyboard/snvs_pwrkey.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,9 @@ static int imx_snvs_pwrkey_probe(struct platform_device *pdev)
111111
return -ENOMEM;
112112

113113
pdata->snvs = syscon_regmap_lookup_by_phandle(np, "regmap");
114-
if (!pdata->snvs) {
114+
if (IS_ERR(pdata->snvs)) {
115115
dev_err(&pdev->dev, "Can't get snvs syscon\n");
116-
return -ENODEV;
116+
return PTR_ERR(pdata->snvs);
117117
}
118118

119119
if (of_property_read_u32(np, "linux,keycode", &pdata->keycode)) {

0 commit comments

Comments
 (0)