[fix][device] 修正使用rt_device_create创建设备,使用rt_device_destroy删除失败的问题
This commit is contained in:
parent
2e224b30ad
commit
7469edd165
|
@ -163,7 +163,7 @@ void rt_device_destroy(rt_device_t dev)
|
||||||
{
|
{
|
||||||
/* parameter check */
|
/* parameter check */
|
||||||
RT_ASSERT(dev != RT_NULL);
|
RT_ASSERT(dev != RT_NULL);
|
||||||
RT_ASSERT(rt_object_get_type(&dev->parent) == RT_Object_Class_Device);
|
RT_ASSERT(rt_object_get_type(&dev->parent) == RT_Object_Class_Null);
|
||||||
RT_ASSERT(rt_object_is_systemobject(&dev->parent) == RT_FALSE);
|
RT_ASSERT(rt_object_is_systemobject(&dev->parent) == RT_FALSE);
|
||||||
|
|
||||||
rt_object_detach(&(dev->parent));
|
rt_object_detach(&(dev->parent));
|
||||||
|
|
|
@ -429,7 +429,7 @@ void rt_object_detach(rt_object_t object)
|
||||||
rt_list_remove(&(object->list));
|
rt_list_remove(&(object->list));
|
||||||
rt_spin_unlock_irqrestore(&(information->spinlock), level);
|
rt_spin_unlock_irqrestore(&(information->spinlock), level);
|
||||||
|
|
||||||
object->type = 0;
|
object->type = RT_Object_Class_Null;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef RT_USING_HEAP
|
#ifdef RT_USING_HEAP
|
||||||
|
|
Loading…
Reference in New Issue