Commit 64e9e22e authored by Alexandre Belloni's avatar Alexandre Belloni Committed by Olof Johansson

soc: fsl: qbman: qman: avoid allocating from non existing gen_pool

If the qman driver didn't probe, calling qman_alloc_fqid_range,
qman_alloc_pool_range or qman_alloc_cgrid_range (as done in dpaa_eth) will
pass a NULL pointer to gen_pool_alloc, leading to a NULL pointer
dereference.
Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
Reviewed-by: default avatarRoy Pledge <roy.pledge@nxp.com>
Signed-off-by: default avatarLi Yang <leoyang.li@nxp.com>
(cherry picked from commit f72487a2788aa70c3aee1d0ebd5470de9bac953a)
Signed-off-by: default avatarOlof Johansson <olof@lixom.net>
parent 1a677ff4
...@@ -2729,6 +2729,9 @@ static int qman_alloc_range(struct gen_pool *p, u32 *result, u32 cnt) ...@@ -2729,6 +2729,9 @@ static int qman_alloc_range(struct gen_pool *p, u32 *result, u32 cnt)
{ {
unsigned long addr; unsigned long addr;
if (!p)
return -ENODEV;
addr = gen_pool_alloc(p, cnt); addr = gen_pool_alloc(p, cnt);
if (!addr) if (!addr)
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment