summaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
authorAnson Huang <anson.huang@nxp.com>2019-04-03 15:14:44 -0700
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2019-04-03 16:10:57 -0700
commitbf2a7ca39fd3ab47ef71c621a7ee69d1813b1f97 (patch)
treea8115e33a4c7b44725cf1fc2150d968a828d2b42 /drivers/input
parentc01908a14bf735b871170092807c618bb9dae654 (diff)
downloadlinux-stable-bf2a7ca39fd3ab47ef71c621a7ee69d1813b1f97.tar.gz
linux-stable-bf2a7ca39fd3ab47ef71c621a7ee69d1813b1f97.tar.bz2
linux-stable-bf2a7ca39fd3ab47ef71c621a7ee69d1813b1f97.zip
Input: snvs_pwrkey - initialize necessary driver data before enabling IRQ
SNVS IRQ is requested before necessary driver data initialized, if there is a pending IRQ during driver probe phase, kernel NULL pointer panic will occur in IRQ handler. To avoid such scenario, just initialize necessary driver data before enabling IRQ. This patch is inspired by NXP's internal kernel tree. Fixes: d3dc6e232215 ("input: keyboard: imx: add snvs power key driver") Signed-off-by: Anson Huang <Anson.Huang@nxp.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/keyboard/snvs_pwrkey.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/input/keyboard/snvs_pwrkey.c b/drivers/input/keyboard/snvs_pwrkey.c
index effb63205d3d..4c67cf30a5d9 100644
--- a/drivers/input/keyboard/snvs_pwrkey.c
+++ b/drivers/input/keyboard/snvs_pwrkey.c
@@ -148,6 +148,9 @@ static int imx_snvs_pwrkey_probe(struct platform_device *pdev)
return error;
}
+ pdata->input = input;
+ platform_set_drvdata(pdev, pdata);
+
error = devm_request_irq(&pdev->dev, pdata->irq,
imx_snvs_pwrkey_interrupt,
0, pdev->name, pdev);
@@ -163,9 +166,6 @@ static int imx_snvs_pwrkey_probe(struct platform_device *pdev)
return error;
}
- pdata->input = input;
- platform_set_drvdata(pdev, pdata);
-
device_init_wakeup(&pdev->dev, pdata->wakeup);
return 0;