summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/fsl-mc/mc.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/net/fsl-mc/mc.c b/drivers/net/fsl-mc/mc.c
index 86daf0fb2bb..999a9912e2f 100644
--- a/drivers/net/fsl-mc/mc.c
+++ b/drivers/net/fsl-mc/mc.c
@@ -1178,6 +1178,7 @@ err_get_api_ver:
dflt_dpio->dpio_id);
err_create:
free(dflt_dpio);
+ dflt_dpio = NULL;
err_calloc:
return err;
}
@@ -1186,6 +1187,9 @@ static int dpio_exit(void)
{
int err;
+ if (!dflt_dpio)
+ return -ENODEV;
+
err = dpio_disable(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpio->dpio_handle);
if (err < 0) {
printf("dpio_disable() failed: %d\n", err);
@@ -1211,8 +1215,8 @@ static int dpio_exit(void)
printf("Exit: DPIO.%d\n", dflt_dpio->dpio_id);
#endif
- if (dflt_dpio)
- free(dflt_dpio);
+ free(dflt_dpio);
+ dflt_dpio = NULL;
return 0;
err: