[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <tencent_A0D4966C4180DD7B582A20A06A49ECDD600A@qq.com>
Date: Sat, 26 Aug 2023 19:09:19 +0800
From: Zhang Shurong <zhang_shurong@...mail.com>
To: amitk@...nel.org
Cc: thara.gopinath@...il.com, agross@...nel.org, andersson@...nel.org,
konrad.dybcio@...aro.org, rafael@...nel.org,
daniel.lezcano@...aro.org, rui.zhang@...el.com,
linux-pm@...r.kernel.org, linux-arm-msm@...r.kernel.org,
linux-kernel@...r.kernel.org,
Zhang Shurong <zhang_shurong@...mail.com>
Subject: [PATCH] thermal/drivers/qcom/lmh: Fix missing IRQ check in lmh_probe()
This func misses checking for platform_get_irq()'s call and may passes the
negative error codes to request_irq(), which takes unsigned IRQ #,
causing it to fail with -EINVAL, overriding an original error code.
Fix this by stop calling request_irq() with invalid IRQ #s.
Fixes: 53bca371cdf7 ("thermal/drivers/qcom: Add support for LMh driver")
Signed-off-by: Zhang Shurong <zhang_shurong@...mail.com>
---
drivers/thermal/qcom/lmh.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/thermal/qcom/lmh.c b/drivers/thermal/qcom/lmh.c
index f6edb12ec004..38aedb9a7c67 100644
--- a/drivers/thermal/qcom/lmh.c
+++ b/drivers/thermal/qcom/lmh.c
@@ -198,7 +198,11 @@ static int lmh_probe(struct platform_device *pdev)
return ret;
}
- lmh_data->irq = platform_get_irq(pdev, 0);
+ ret = platform_get_irq(pdev, 0);
+ if (ret < 0)
+ return ret;
+
+ lmh_data->irq = ret;
lmh_data->domain = irq_domain_add_linear(np, 1, &lmh_irq_ops, lmh_data);
if (!lmh_data->domain) {
dev_err(dev, "Error adding irq_domain\n");
--
2.30.2
Powered by blists - more mailing lists