kernel: device: MISRA C compliance.

This patch fixes few issues in device.c.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
This commit is contained in:
Adithya Baglody 2018-10-25 12:04:25 +05:30 committed by Anas Nashif
commit 8feda92abc
2 changed files with 8 additions and 7 deletions

View file

@ -234,7 +234,7 @@ struct device {
void *driver_data;
};
void _sys_device_do_config_level(int level);
void _sys_device_do_config_level(s32_t level);
/**
* @brief Retrieve the device structure for a driver by name

View file

@ -43,15 +43,15 @@ extern u32_t __device_busy_end[];
*
* @param level init level to run.
*/
void _sys_device_do_config_level(int level)
void _sys_device_do_config_level(s32_t level)
{
struct device *info;
for (info = config_levels[level]; info < config_levels[level+1];
info++) {
struct device_config *device = info->config;
struct device_config *device_conf = info->config;
(void)device->init(info);
(void)device_conf->init(info);
_k_object_init(info);
}
}
@ -66,17 +66,18 @@ struct device *device_get_binding(const char *name)
* performed. Reserve string comparisons for a fallback.
*/
for (info = __device_init_start; info != __device_init_end; info++) {
if (info->driver_api != NULL && info->config->name == name) {
if ((info->driver_api != NULL) &&
(info->config->name == name)) {
return info;
}
}
for (info = __device_init_start; info != __device_init_end; info++) {
if (!info->driver_api) {
if (info->driver_api == NULL) {
continue;
}
if (!strcmp(name, info->config->name)) {
if (strcmp(name, info->config->name) == 0) {
return info;
}
}