From: Miaoqian Lin <linmq006@gmail.com>
To: Stuart Yoder <stuyoder@gmail.com>,
Laurentiu Tudor <laurentiu.tudor@nxp.com>,
Makarand Pawagi <makarand.pawagi@nxp.com>,
Diana Craciun <diana.craciun@oss.nxp.com>,
Catalin Marinas <catalin.marinas@arm.com>,
linux-kernel@vger.kernel.org
Cc: linmq006@gmail.com
Subject: [PATCH] bus: fsl-mc: Check the platform_get_resource() return value
Date: Mon, 4 Apr 2022 14:24:26 +0000 [thread overview]
Message-ID: <20220404142427.11418-1-linmq006@gmail.com> (raw)
platform_get_resource() may fail and return NULL, so check it's value
before using it.
Fixes: 6305166c8771 ("bus: fsl-mc: Add ACPI support for fsl-mc")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
drivers/bus/fsl-mc/fsl-mc-bus.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/bus/fsl-mc/fsl-mc-bus.c b/drivers/bus/fsl-mc/fsl-mc-bus.c
index 8fd4a356a86e..ab520b4ce885 100644
--- a/drivers/bus/fsl-mc/fsl-mc-bus.c
+++ b/drivers/bus/fsl-mc/fsl-mc-bus.c
@@ -1168,6 +1168,9 @@ static int fsl_mc_bus_probe(struct platform_device *pdev)
* Get physical address of MC portal for the root DPRC:
*/
plat_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (!plat_res)
+ return -EINVAL;
+
mc_portal_phys_addr = plat_res->start;
mc_portal_size = resource_size(plat_res);
mc_portal_base_phys_addr = mc_portal_phys_addr & ~0x3ffffff;
--
2.17.1
reply other threads:[~2022-04-04 14:24 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220404142427.11418-1-linmq006@gmail.com \
--to=linmq006@gmail.com \
--cc=catalin.marinas@arm.com \
--cc=diana.craciun@oss.nxp.com \
--cc=laurentiu.tudor@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=makarand.pawagi@nxp.com \
--cc=stuyoder@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®