[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211116190443.2418144-1-sashal@kernel.org>
Date: Tue, 16 Nov 2021 14:03:21 -0500
From: Sasha Levin <sashal@...nel.org>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org
Cc: Tang Bin <tangbin@...s.chinamobile.com>,
Dmitry Torokhov <dmitry.torokhov@...il.com>,
Sasha Levin <sashal@...nel.org>,
sebastian.reichel@...labora.com, linux-input@...r.kernel.org
Subject: [PATCH AUTOSEL 5.15 01/65] Input: cpcap-pwrbutton - handle errors from platform_get_irq()
From: Tang Bin <tangbin@...s.chinamobile.com>
[ 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@...s.chinamobile.com>
Link: https://lore.kernel.org/r/20210802121740.8700-1-tangbin@cmss.chinamobile.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@...il.com>
Signed-off-by: Sasha Levin <sashal@...nel.org>
---
drivers/input/misc/cpcap-pwrbutton.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/input/misc/cpcap-pwrbutton.c b/drivers/input/misc/cpcap-pwrbutton.c
index 0abef63217e21..372cb44d06357 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;
--
2.33.0
Powered by blists - more mailing lists