mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-23 09:47:44 +00:00
hv: fix 'No brackets to then/else'
- add missing brackets for 'if/else' statements based on MISRA-C requirements v1 -> v2: * add brackets for each conditions in 'if' statements to improve the readability * modify 'ptdev_init' to make the logic clearer Tracked-On: #861 Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
This commit is contained in:
@@ -38,23 +38,28 @@ void npk_log_setup(struct hv_npk_log_param *param)
|
||||
param->mmio_addr);
|
||||
|
||||
param->res = HV_NPK_LOG_RES_KO;
|
||||
if (atomic_inc_return(&npk_log_setup_ref) > 1)
|
||||
if (atomic_inc_return(&npk_log_setup_ref) > 1) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
switch (param->cmd) {
|
||||
case HV_NPK_LOG_CMD_CONF:
|
||||
if ((param->mmio_addr != 0UL) || (param->loglevel != 0xffffU))
|
||||
if ((param->mmio_addr != 0UL) || (param->loglevel != 0xffffU)) {
|
||||
param->res = HV_NPK_LOG_RES_OK;
|
||||
}
|
||||
/* falls through */
|
||||
case HV_NPK_LOG_CMD_ENABLE:
|
||||
if (param->mmio_addr != 0UL)
|
||||
if (param->mmio_addr != 0UL) {
|
||||
base = param->mmio_addr;
|
||||
if (param->loglevel != 0xffffU)
|
||||
}
|
||||
if (param->loglevel != 0xffffU) {
|
||||
npk_loglevel = param->loglevel;
|
||||
}
|
||||
if ((base != 0UL) && (param->cmd == HV_NPK_LOG_CMD_ENABLE)) {
|
||||
if (!npk_log_enabled)
|
||||
if (!npk_log_enabled) {
|
||||
for (i = 0; i < phys_cpu_num; i++)
|
||||
per_cpu(npk_log_ref, i) = 0;
|
||||
}
|
||||
param->res = HV_NPK_LOG_RES_OK;
|
||||
npk_log_enabled = 1;
|
||||
}
|
||||
@@ -88,8 +93,9 @@ void npk_log_write(const char *buf, size_t buf_len)
|
||||
uint32_t ref;
|
||||
uint16_t len;
|
||||
|
||||
if (!npk_log_enabled || (channel == NULL))
|
||||
if (!npk_log_enabled || (channel == NULL)) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* calculate the channel offset based on cpu_id and npk_log_ref */
|
||||
ref = (atomic_inc_return((int32_t *)&per_cpu(npk_log_ref, cpu_id)) - 1)
|
||||
|
Reference in New Issue
Block a user