Skip to content

Commit

Permalink
soc: fsl: qe: Check of ioremap return value
Browse files Browse the repository at this point in the history
[ Upstream commit a222fd8 ]

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: 7aa1aa6 ("QE: Move QE from arch/powerpc to drivers/soc")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Signed-off-by: Li Yang <leoyang.li@nxp.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
JiangJias authored and gregkh committed Mar 8, 2022
1 parent 2824f69 commit fbb8108
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/soc/fsl/qe/qe_io.c
Expand Up @@ -35,6 +35,8 @@ int par_io_init(struct device_node *np)
if (ret)
return ret;
par_io = ioremap(res.start, resource_size(&res));
if (!par_io)
return -ENOMEM;

if (!of_property_read_u32(np, "num-ports", &num_ports))
num_par_io_ports = num_ports;
Expand Down

0 comments on commit fbb8108

Please sign in to comment.