提交 bd3bd3b3 编写于 作者: C Colin Ian King 提交者: Li Yang

soc: fsl: dpio: fix memory leak of a struct qbman on error exit path

Currently the error check for a null reg leaks a struct qbman
that was allocated earlier. Fix this by kfree'ing p on the error exit
path.
Signed-off-by: NColin Ian King <colin.king@canonical.com>
Signed-off-by: NLi Yang <leoyang.li@nxp.com>
上级 c1959066
...@@ -180,6 +180,7 @@ struct qbman_swp *qbman_swp_init(const struct qbman_swp_desc *d) ...@@ -180,6 +180,7 @@ struct qbman_swp *qbman_swp_init(const struct qbman_swp_desc *d)
reg = qbman_read_register(p, QBMAN_CINH_SWP_CFG); reg = qbman_read_register(p, QBMAN_CINH_SWP_CFG);
if (!reg) { if (!reg) {
pr_err("qbman: the portal is not enabled!\n"); pr_err("qbman: the portal is not enabled!\n");
kfree(p);
return NULL; return NULL;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册