Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/drivers/core/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
2 changes: 1 addition & 1 deletion src/object.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading