Commit 644a3fe2 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 20ce3458
......@@ -239,8 +239,12 @@ int gatepeterson_destroy(void)
goto exit;
}
if (atomic_dec_return(&gatepeterson_state.ref_count)
== GATEPETERSON_MAKE_MAGICSTAMP(0)) {
if (!(atomic_dec_return(&gatepeterson_state.ref_count)
== GATEPETERSON_MAKE_MAGICSTAMP(0))) {
retval = 1;
goto exit;
}
/* Temporarily increment ref_count here. */
atomic_set(&gatepeterson_state.ref_count,
GATEPETERSON_MAKE_MAGICSTAMP(1));
......@@ -261,8 +265,6 @@ int gatepeterson_destroy(void)
/* Again reset ref_count. */
atomic_set(&gatepeterson_state.ref_count,
GATEPETERSON_MAKE_MAGICSTAMP(0));
}
retval = mutex_lock_interruptible(gatepeterson_state.mod_lock);
if (retval != 0)
......
......@@ -576,8 +576,6 @@ int notify_ducatidrv_delete(struct notify_driver_object **handle_ptr)
WARN_ON(1);
/*FIXME: Exit gracefully */
}
omap_mbox_put(ducati_mbox);
ducati_mbox = NULL;
kfree(driver_obj);
driver_obj = NULL;
......@@ -624,6 +622,8 @@ int notify_ducatidrv_destroy(void)
atomic_set(&(notify_ducatidriver_state.ref_count),
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)
atomic_cmpmask_and_set(&(notify_ducatidriver_state.ref_count),
NOTIFYDRIVERSHM_MAKE_MAGICSTAMP(0),
NOTIFYDRIVERSHM_MAKE_MAGICSTAMP(0));
if (atomic_inc_return(&(notify_ducatidriver_state.ref_count)) !=
NOTIFYDRIVERSHM_MAKE_MAGICSTAMP(1u)) {
return 1;
......@@ -679,6 +678,7 @@ int notify_ducatidrv_setup(struct notify_ducatidrv_config *cfg)
atomic_set(&(notify_ducatidriver_state.ref_count),
NOTIFYDRIVERSHM_MAKE_MAGICSTAMP(0));
status = -ENOMEM;
goto error_exit;
} else {
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