diff options
author | Yang Yingliang <yangyingliang@huawei.com> | 2022-06-28 16:02:49 +0200 |
---|---|---|
committer | Shawn Guo <shawnguo@kernel.org> | 2022-07-05 02:41:55 +0200 |
commit | 63f98153075167a6c88d8ac90bfd26f1887c670c (patch) | |
tree | 71df5ac55682cddc8d64aae37b091e598d1fec40 /drivers/soc | |
parent | soc: fsl: guts: fix return value check in fsl_guts_init() (diff) | |
download | linux-63f98153075167a6c88d8ac90bfd26f1887c670c.tar.xz linux-63f98153075167a6c88d8ac90bfd26f1887c670c.zip |
soc: fsl: guts: check return value after calling of_iomap() in fsl_guts_get_soc_uid()
of_iomap() may return NULL, so we need check the return value.
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Reviewed-by: Michael Walle <michael@walle.cc>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>
Diffstat (limited to 'drivers/soc')
-rw-r--r-- | drivers/soc/fsl/guts.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/soc/fsl/guts.c b/drivers/soc/fsl/guts.c index 8038c599ad83..6bf3e6a980ff 100644 --- a/drivers/soc/fsl/guts.c +++ b/drivers/soc/fsl/guts.c @@ -126,6 +126,10 @@ static u64 fsl_guts_get_soc_uid(const char *compat, unsigned int offset) return 0; sfp_base = of_iomap(np, 0); + if (!sfp_base) { + of_node_put(np); + return 0; + } uid = ioread32(sfp_base + offset); uid <<= 32; |