debug: 确保 rt_console_set_device
可以将 _console_device
置为 NULL
Signed-off-by: a1012112796 <1012112796@qq.com>
This commit is contained in:
@@ -746,8 +746,6 @@ rt_device_t rt_console_set_device(const char *name)
|
|||||||
/* check whether it's a same device */
|
/* check whether it's a same device */
|
||||||
if (new_device == old_device) return RT_NULL;
|
if (new_device == old_device) return RT_NULL;
|
||||||
|
|
||||||
if (new_device != RT_NULL)
|
|
||||||
{
|
|
||||||
if (_console_device != RT_NULL)
|
if (_console_device != RT_NULL)
|
||||||
{
|
{
|
||||||
/* close old console device */
|
/* close old console device */
|
||||||
@@ -755,9 +753,9 @@ rt_device_t rt_console_set_device(const char *name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* set new console device */
|
/* set new console device */
|
||||||
|
if (new_device != RT_NULL)
|
||||||
rt_device_open(new_device, RT_DEVICE_OFLAG_RDWR | RT_DEVICE_FLAG_STREAM);
|
rt_device_open(new_device, RT_DEVICE_OFLAG_RDWR | RT_DEVICE_FLAG_STREAM);
|
||||||
_console_device = new_device;
|
_console_device = new_device;
|
||||||
}
|
|
||||||
|
|
||||||
return old_device;
|
return old_device;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user