driver: net: fsl-mc: Free dflt_dpio pointer after its usage
authorPrabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
Fri, 18 Mar 2016 10:45:29 +0000 (16:15 +0530)
committerYork Sun <york.sun@nxp.com>
Tue, 29 Mar 2016 00:35:38 +0000 (17:35 -0700)
Free dflt_dpio pointer after its usage during error handling

Signed-off-by: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
Reported-by: Jose Rivera <german.rivera@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
drivers/net/fsl-mc/mc.c

index f83bd0c7f0b371510532ee991eb4ba94ae38ad4a..d2b8b5c47f15b757548a8b574e76f322b22e8da0 100644 (file)
@@ -747,11 +747,11 @@ static int dpio_init(void)
 err_get_swp_init:
        dpio_disable(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpio->dpio_handle);
 err_get_enable:
-       free(dflt_dpio);
 err_get_attr:
        dpio_close(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpio->dpio_handle);
        dpio_destroy(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpio->dpio_handle);
 err_create:
+       free(dflt_dpio);
 err_malloc:
        return err;
 }