提交 4248e217 编写于 作者: J Jiasheng Jiang 提交者: Zheng Zengkai

soc: fsl: qe: Check of ioremap return value

stable inclusion
from stable-v5.10.104
commit fbb810825aff29e8e594538e5ef3c7a2dd670f96
bugzilla: https://gitee.com/openeuler/kernel/issues/I56XAC

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=fbb810825aff29e8e594538e5ef3c7a2dd670f96

--------------------------------

[ Upstream commit a222fd85 ]

As the possible failure of the ioremap(), the par_io could be NULL.
Therefore it should be better to check it and return error in order to
guarantee the success of the initiation.
But, I also notice that all the caller like mpc85xx_qe_par_io_init() in
`arch/powerpc/platforms/85xx/common.c` don't check the return value of
the par_io_init().
Actually, par_io_init() needs to check to handle the potential error.
I will submit another patch to fix that.
Anyway, par_io_init() itsely should be fixed.

Fixes: 7aa1aa6e ("QE: Move QE from arch/powerpc to drivers/soc")
Signed-off-by: NJiasheng Jiang <jiasheng@iscas.ac.cn>
Signed-off-by: NLi Yang <leoyang.li@nxp.com>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NYu Liao <liaoyu15@huawei.com>
Reviewed-by: NWei Li <liwei391@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 7e963d01
...@@ -35,6 +35,8 @@ int par_io_init(struct device_node *np) ...@@ -35,6 +35,8 @@ int par_io_init(struct device_node *np)
if (ret) if (ret)
return ret; return ret;
par_io = ioremap(res.start, resource_size(&res)); par_io = ioremap(res.start, resource_size(&res));
if (!par_io)
return -ENOMEM;
if (!of_property_read_u32(np, "num-ports", &num_ports)) if (!of_property_read_u32(np, "num-ports", &num_ports))
num_par_io_ports = num_ports; num_par_io_ports = num_ports;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册