summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWBI\nxf44444 <[email protected]>2020-11-17 11:26:28 +0800
committerWBI\nxf44444 <[email protected]>2020-11-17 11:26:28 +0800
commitbfdbcd30f4f34e53d62f5d014acf4481c5a06412 (patch)
tree5043846c3034b4417172270531c04ab3771b0f02 /src
parent8087a901180c9fccb5951d651b7ce01974aea52a (diff)
parentb0f21335631adcd7b788de7b402a175e5ca4a40b (diff)
audio_kconfig
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. */