Commit 1a11912a authored by Simon Que's avatar Simon Que Committed by Hari Kanigeri

SYSLINK: ipc - Fixed cleanup order of operations

Syslink destroy phase was failing because of incorrect order of
operations in gatepeterson and notify ducati.
Signed-off-by: default avatarSimon Que <sque@ti.com>
parent d07bcdda
...@@ -239,8 +239,12 @@ int gatepeterson_destroy(void) ...@@ -239,8 +239,12 @@ int gatepeterson_destroy(void)
goto exit; goto exit;
} }
if (atomic_dec_return(&gatepeterson_state.ref_count) if (!(atomic_dec_return(&gatepeterson_state.ref_count)
== GATEPETERSON_MAKE_MAGICSTAMP(0)) { == GATEPETERSON_MAKE_MAGICSTAMP(0))) {
retval = 1;
goto exit;
}
/* Temporarily increment ref_count here. */ /* Temporarily increment ref_count here. */
atomic_set(&gatepeterson_state.ref_count, atomic_set(&gatepeterson_state.ref_count,
GATEPETERSON_MAKE_MAGICSTAMP(1)); GATEPETERSON_MAKE_MAGICSTAMP(1));
...@@ -261,8 +265,6 @@ int gatepeterson_destroy(void) ...@@ -261,8 +265,6 @@ int gatepeterson_destroy(void)
/* Again reset ref_count. */ /* Again reset ref_count. */
atomic_set(&gatepeterson_state.ref_count, atomic_set(&gatepeterson_state.ref_count,
GATEPETERSON_MAKE_MAGICSTAMP(0)); GATEPETERSON_MAKE_MAGICSTAMP(0));
}
retval = mutex_lock_interruptible(gatepeterson_state.mod_lock); retval = mutex_lock_interruptible(gatepeterson_state.mod_lock);
if (retval != 0) if (retval != 0)
......
...@@ -576,8 +576,6 @@ int notify_ducatidrv_delete(struct notify_driver_object **handle_ptr) ...@@ -576,8 +576,6 @@ int notify_ducatidrv_delete(struct notify_driver_object **handle_ptr)
WARN_ON(1); WARN_ON(1);
/*FIXME: Exit gracefully */ /*FIXME: Exit gracefully */
} }
omap_mbox_put(ducati_mbox);
ducati_mbox = NULL;
kfree(driver_obj); kfree(driver_obj);
driver_obj = NULL; driver_obj = NULL;
...@@ -624,6 +622,8 @@ int notify_ducatidrv_destroy(void) ...@@ -624,6 +622,8 @@ int notify_ducatidrv_destroy(void)
atomic_set(&(notify_ducatidriver_state.ref_count), atomic_set(&(notify_ducatidriver_state.ref_count),
NOTIFYDRIVERSHM_MAKE_MAGICSTAMP(0)); NOTIFYDRIVERSHM_MAKE_MAGICSTAMP(0));
omap_mbox_put(ducati_mbox);
ducati_mbox = NULL;
} }
...@@ -663,7 +663,6 @@ int notify_ducatidrv_setup(struct notify_ducatidrv_config *cfg) ...@@ -663,7 +663,6 @@ int notify_ducatidrv_setup(struct notify_ducatidrv_config *cfg)
atomic_cmpmask_and_set(&(notify_ducatidriver_state.ref_count), atomic_cmpmask_and_set(&(notify_ducatidriver_state.ref_count),
NOTIFYDRIVERSHM_MAKE_MAGICSTAMP(0), NOTIFYDRIVERSHM_MAKE_MAGICSTAMP(0),
NOTIFYDRIVERSHM_MAKE_MAGICSTAMP(0)); NOTIFYDRIVERSHM_MAKE_MAGICSTAMP(0));
if (atomic_inc_return(&(notify_ducatidriver_state.ref_count)) != if (atomic_inc_return(&(notify_ducatidriver_state.ref_count)) !=
NOTIFYDRIVERSHM_MAKE_MAGICSTAMP(1u)) { NOTIFYDRIVERSHM_MAKE_MAGICSTAMP(1u)) {
return 1; return 1;
...@@ -679,6 +678,7 @@ int notify_ducatidrv_setup(struct notify_ducatidrv_config *cfg) ...@@ -679,6 +678,7 @@ int notify_ducatidrv_setup(struct notify_ducatidrv_config *cfg)
atomic_set(&(notify_ducatidriver_state.ref_count), atomic_set(&(notify_ducatidriver_state.ref_count),
NOTIFYDRIVERSHM_MAKE_MAGICSTAMP(0)); NOTIFYDRIVERSHM_MAKE_MAGICSTAMP(0));
status = -ENOMEM; status = -ENOMEM;
goto error_exit; goto error_exit;
} else { } else {
memcpy(&notify_ducatidriver_state.cfg, memcpy(&notify_ducatidriver_state.cfg,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment