Skip to content

Commit

Permalink
soc: fsl: dpio: fix memory leak of a struct qbman on error exit path
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Colin Ian King authored and Li Yang committed Feb 19, 2019
1 parent c195906 commit bd3bd3b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/soc/fsl/dpio/qbman-portal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit bd3bd3b

Please sign in to comment.