From 8feda92abc6559e6ee35bfe3282625523e49d9ed Mon Sep 17 00:00:00 2001 From: Adithya Baglody Date: Thu, 25 Oct 2018 12:04:25 +0530 Subject: [PATCH] kernel: device: MISRA C compliance. This patch fixes few issues in device.c. Signed-off-by: Adithya Baglody --- include/device.h | 2 +- kernel/device.c | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/include/device.h b/include/device.h index 2f68a357a6f..7e2b95a04d9 100644 --- a/include/device.h +++ b/include/device.h @@ -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 diff --git a/kernel/device.c b/kernel/device.c index fa67abb14cf..2cd588cca4b 100644 --- a/kernel/device.c +++ b/kernel/device.c @@ -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; } }