提交 ea89767f 编写于 作者: T thread-liu

[update] check whether it's a same console device.

上级 7f50e7f2
...@@ -1116,7 +1116,7 @@ RTM_EXPORT(rt_console_get_device); ...@@ -1116,7 +1116,7 @@ RTM_EXPORT(rt_console_get_device);
* *
* @param name the name of new console 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) rt_device_t rt_console_set_device(const char *name)
{ {
...@@ -1127,6 +1127,10 @@ 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 */ /* find new console device */
new_device = rt_device_find(name); 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 (new_device != RT_NULL)
{ {
if (_console_device != RT_NULL) if (_console_device != RT_NULL)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册