summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/kservice.c6
-rw-r--r--src/memheap.c4
2 files changed, 7 insertions, 3 deletions
diff --git a/src/kservice.c b/src/kservice.c
index 7caf43ce28..0a74f05268 100644
--- a/src/kservice.c
+++ b/src/kservice.c
@@ -1116,7 +1116,7 @@ RTM_EXPORT(rt_console_get_device);
*
* @param name the name of new console device
*
- * @return the old console device handler
+ * @return the old console device handler on successful, or RT_NULL on failure.
*/
rt_device_t rt_console_set_device(const char *name)
{
@@ -1127,6 +1127,10 @@ rt_device_t rt_console_set_device(const char *name)
/* find new console device */
new_device = rt_device_find(name);
+
+ /* check whether it's a same device */
+ if (new_device == old_device) return RT_NULL;
+
if (new_device != RT_NULL)
{
if (_console_device != RT_NULL)
diff --git a/src/memheap.c b/src/memheap.c
index aef56e1a74..0ff6925696 100644
--- a/src/memheap.c
+++ b/src/memheap.c
@@ -126,8 +126,8 @@ rt_err_t rt_memheap_detach(struct rt_memheap *heap)
RT_ASSERT(heap);
RT_ASSERT(rt_object_get_type(&heap->parent) == RT_Object_Class_MemHeap);
RT_ASSERT(rt_object_is_systemobject(&heap->parent));
-
- rt_object_detach(&(heap->lock.parent.parent));
+
+ rt_sem_detach(&heap->lock);
rt_object_detach(&(heap->parent));
/* Return a successful completion. */