[Kernel] fix the compiling warning.
This commit is contained in:
parent
d219f5bfa9
commit
992e10ae08
30
src/device.c
30
src/device.c
|
@ -150,20 +150,20 @@ RTM_EXPORT(rt_device_find);
|
||||||
*/
|
*/
|
||||||
rt_device_t rt_device_create(int type, int attach_size)
|
rt_device_t rt_device_create(int type, int attach_size)
|
||||||
{
|
{
|
||||||
int size;
|
int size;
|
||||||
rt_device_t device;
|
rt_device_t device;
|
||||||
|
|
||||||
size = RT_ALIGN(sizeof(struct rt_device), RT_ALIGN_SIZE);
|
size = RT_ALIGN(sizeof(struct rt_device), RT_ALIGN_SIZE);
|
||||||
size += attach_size;
|
size += attach_size;
|
||||||
|
|
||||||
device = (rt_device_t)rt_malloc(size);
|
device = (rt_device_t)rt_malloc(size);
|
||||||
if (device)
|
if (device)
|
||||||
{
|
{
|
||||||
rt_memset(device, 0x0, sizeof(struct rt_device));
|
rt_memset(device, 0x0, sizeof(struct rt_device));
|
||||||
device->type = type;
|
device->type = (enum rt_device_class_type)type;
|
||||||
}
|
}
|
||||||
|
|
||||||
return device;
|
return device;
|
||||||
}
|
}
|
||||||
RTM_EXPORT(rt_device_create);
|
RTM_EXPORT(rt_device_create);
|
||||||
|
|
||||||
|
@ -174,11 +174,11 @@ RTM_EXPORT(rt_device_create);
|
||||||
*/
|
*/
|
||||||
void rt_device_destroy(rt_device_t device)
|
void rt_device_destroy(rt_device_t device)
|
||||||
{
|
{
|
||||||
/* unregister device firstly */
|
/* unregister device firstly */
|
||||||
rt_device_unregister(device);
|
rt_device_unregister(device);
|
||||||
|
|
||||||
/* release this device object */
|
/* release this device object */
|
||||||
rt_free(device);
|
rt_free(device);
|
||||||
}
|
}
|
||||||
RTM_EXPORT(rt_device_destroy);
|
RTM_EXPORT(rt_device_destroy);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -522,7 +522,7 @@ rt_object_t rt_object_find(const char *name, rt_uint8_t type)
|
||||||
/* try to find object */
|
/* try to find object */
|
||||||
if (information == RT_NULL)
|
if (information == RT_NULL)
|
||||||
{
|
{
|
||||||
information = rt_object_get_information(type);
|
information = rt_object_get_information((enum rt_object_class_type)type);
|
||||||
RT_ASSERT(information != RT_NULL);
|
RT_ASSERT(information != RT_NULL);
|
||||||
}
|
}
|
||||||
for (node = information->object_list.next;
|
for (node = information->object_list.next;
|
||||||
|
|
Loading…
Reference in New Issue