diff options
author | Tang Bin <tangbin@cmss.chinamobile.com> | 2021-09-05 18:57:32 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-07-12 16:34:51 +0200 |
commit | 8d1d6b29baa98135994a1d5d1b5d471677e04773 (patch) | |
tree | 2d8ee0455586f3a781360e8976094250a3f4fa2b /drivers/input | |
parent | 48f8f198a2ab8e89050aac4ebe6d1a167d73d956 (diff) | |
download | linux-stable-8d1d6b29baa98135994a1d5d1b5d471677e04773.tar.gz linux-stable-8d1d6b29baa98135994a1d5d1b5d471677e04773.tar.bz2 linux-stable-8d1d6b29baa98135994a1d5d1b5d471677e04773.zip |
Input: cpcap-pwrbutton - handle errors from platform_get_irq()
[ Upstream commit 58ae4004b9c4bb040958cf73986b687a5ea4d85d ]
The function cpcap_power_button_probe() does not perform
sufficient error checking after executing platform_get_irq(),
thus fix it.
Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
Link: https://lore.kernel.org/r/20210802121740.8700-1-tangbin@cmss.chinamobile.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/misc/cpcap-pwrbutton.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/input/misc/cpcap-pwrbutton.c b/drivers/input/misc/cpcap-pwrbutton.c index 0abef63217e2..372cb44d0635 100644 --- a/drivers/input/misc/cpcap-pwrbutton.c +++ b/drivers/input/misc/cpcap-pwrbutton.c @@ -54,9 +54,13 @@ static irqreturn_t powerbutton_irq(int irq, void *_button) static int cpcap_power_button_probe(struct platform_device *pdev) { struct cpcap_power_button *button; - int irq = platform_get_irq(pdev, 0); + int irq; int err; + irq = platform_get_irq(pdev, 0); + if (irq < 0) + return irq; + button = devm_kmalloc(&pdev->dev, sizeof(*button), GFP_KERNEL); if (!button) return -ENOMEM; |