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: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Li Yang <leoyang.li@nxp.com>
This commit is contained in:
Colin Ian King 2019-02-19 14:05:17 +00:00 committed by Li Yang
parent c1959066ac
commit bd3bd3b36d
1 changed files with 1 additions and 0 deletions

View File

@ -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);
if (!reg) {
pr_err("qbman: the portal is not enabled!\n");
kfree(p);
return NULL;
}