From 992e10ae08077fb11f4a125721c353aa1123916f Mon Sep 17 00:00:00 2001 From: BernardXiong Date: Sun, 31 Dec 2017 14:45:16 +0800 Subject: [PATCH] [Kernel] fix the compiling warning. --- src/device.c | 30 +++++++++++++++--------------- src/object.c | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/device.c b/src/device.c index 15e44e59d1..231a052b86 100644 --- a/src/device.c +++ b/src/device.c @@ -150,20 +150,20 @@ RTM_EXPORT(rt_device_find); */ rt_device_t rt_device_create(int type, int attach_size) { - int size; - rt_device_t device; + int size; + rt_device_t device; - size = RT_ALIGN(sizeof(struct rt_device), RT_ALIGN_SIZE); - size += attach_size; + size = RT_ALIGN(sizeof(struct rt_device), RT_ALIGN_SIZE); + size += attach_size; - device = (rt_device_t)rt_malloc(size); - if (device) - { - rt_memset(device, 0x0, sizeof(struct rt_device)); - device->type = type; - } + device = (rt_device_t)rt_malloc(size); + if (device) + { + rt_memset(device, 0x0, sizeof(struct rt_device)); + device->type = (enum rt_device_class_type)type; + } - return device; + return device; } RTM_EXPORT(rt_device_create); @@ -174,11 +174,11 @@ RTM_EXPORT(rt_device_create); */ void rt_device_destroy(rt_device_t device) { - /* unregister device firstly */ - rt_device_unregister(device); + /* unregister device firstly */ + rt_device_unregister(device); - /* release this device object */ - rt_free(device); + /* release this device object */ + rt_free(device); } RTM_EXPORT(rt_device_destroy); #endif diff --git a/src/object.c b/src/object.c index 53b8d29371..9225a2bc73 100644 --- a/src/object.c +++ b/src/object.c @@ -522,7 +522,7 @@ rt_object_t rt_object_find(const char *name, rt_uint8_t type) /* try to find object */ 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); } for (node = information->object_list.next;