[fix][device] 修正使用rt_device_create创建设备,使用rt_device_destroy删除失败的问题

This commit is contained in:
Yaochenger 2024-09-03 13:28:06 +08:00 committed by Meco Man
parent 2e224b30ad
commit 7469edd165
2 changed files with 2 additions and 2 deletions

View File

@ -163,7 +163,7 @@ void rt_device_destroy(rt_device_t dev)
{
/* parameter check */
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_object_detach(&(dev->parent));

View File

@ -429,7 +429,7 @@ void rt_object_detach(rt_object_t object)
rt_list_remove(&(object->list));
rt_spin_unlock_irqrestore(&(information->spinlock), level);
object->type = 0;
object->type = RT_Object_Class_Null;
}
#ifdef RT_USING_HEAP