Skip to content

Commit 7469edd

Browse files
Yaochengermysterywolf
authored andcommitted
[fix][device] 修正使用rt_device_create创建设备,使用rt_device_destroy删除失败的问题
1 parent 2e224b3 commit 7469edd

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

components/drivers/core/device.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ void rt_device_destroy(rt_device_t dev)
163163
{
164164
/* parameter check */
165165
RT_ASSERT(dev != RT_NULL);
166-
RT_ASSERT(rt_object_get_type(&dev->parent) == RT_Object_Class_Device);
166+
RT_ASSERT(rt_object_get_type(&dev->parent) == RT_Object_Class_Null);
167167
RT_ASSERT(rt_object_is_systemobject(&dev->parent) == RT_FALSE);
168168

169169
rt_object_detach(&(dev->parent));

src/object.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ void rt_object_detach(rt_object_t object)
429429
rt_list_remove(&(object->list));
430430
rt_spin_unlock_irqrestore(&(information->spinlock), level);
431431

432-
object->type = 0;
432+
object->type = RT_Object_Class_Null;
433433
}
434434

435435
#ifdef RT_USING_HEAP

0 commit comments

Comments
 (0)