[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240806120045.3113451-1-cuigaosheng1@huawei.com>
Date: Tue, 6 Aug 2024 20:00:45 +0800
From: Gaosheng Cui <cuigaosheng1@...wei.com>
To: <sboyd@...nel.org>, <joshc@...eaurora.org>, <gregkh@...uxfoundation.org>,
<kheitke@...eaurora.org>, <cuigaosheng1@...wei.com>
CC: <linux-kernel@...r.kernel.org>
Subject: [PATCH -next,v2] spmi: pmic-arb: Add check for return value of platform_get_resource_byname
Add check for the return value of platform_get_resource_byname() and
return the error if it fails to catch the error.
Fixes: 39ae93e3a31d ("spmi: Add MSM PMIC Arbiter SPMI controller")
Signed-off-by: Gaosheng Cui <cuigaosheng1@...wei.com>
---
v2: Add the fixes tag, thanks!
drivers/spmi/spmi-pmic-arb.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/spmi/spmi-pmic-arb.c b/drivers/spmi/spmi-pmic-arb.c
index 9ba9495fcc4b..5f5f2f0a10b9 100644
--- a/drivers/spmi/spmi-pmic-arb.c
+++ b/drivers/spmi/spmi-pmic-arb.c
@@ -1808,6 +1808,9 @@ static int spmi_pmic_arb_probe(struct platform_device *pdev)
return -ENOMEM;
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "core");
+ if (!res)
+ return -EINVAL;
+
core = devm_ioremap(dev, res->start, resource_size(res));
if (!core)
return -ENOMEM;
--
2.25.1
Powered by blists - more mailing lists