hv: fix 'Expression is not Boolean'

MISRA-C requires that the controlling expression of an if statement or
an iteration-statement shall be Boolean type.

v1 -> v2:
* update the U suffix of constant to let the type of operands
  to bit operations (&) is the same.
* update the type of 'i' from uint64_t to uint16_t in
  'profiling_set_control' since it is limited by phys_cpu_num,
  which is uint16_t.

Tracked-On: #861
Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Shiqing Gao
2018-11-07 14:14:49 +08:00
committed by wenlingz
parent 121454c4bd
commit b430b00a08
14 changed files with 33 additions and 33 deletions

View File

@@ -982,7 +982,7 @@ int32_t profiling_set_control(struct acrn_vm *vm, uint64_t addr)
{
uint64_t old_switch;
uint64_t new_switch;
uint64_t i;
uint16_t i;
struct profiling_control prof_control;
@@ -1005,12 +1005,12 @@ int32_t profiling_set_control(struct acrn_vm *vm, uint64_t addr)
" old_switch: %llu sep_collection_switch: %llu!",
old_switch, sep_collection_switch);
for (i = 0U; i < (uint64_t)MAX_SEP_FEATURE_ID; i++) {
if ((new_switch ^ old_switch) & (0x1U << i)) {
for (i = 0U; i < (uint16_t)MAX_SEP_FEATURE_ID; i++) {
if (((new_switch ^ old_switch) & (0x1UL << i)) != 0UL) {
switch (i) {
case CORE_PMU_SAMPLING:
case CORE_PMU_COUNTING:
if (new_switch & (0x1U << i)) {
if ((new_switch & (0x1UL << i)) != 0UL) {
profiling_start_pmu();
} else {
profiling_stop_pmu();
@@ -1042,8 +1042,8 @@ int32_t profiling_set_control(struct acrn_vm *vm, uint64_t addr)
if (socwatch_collection_switch != 0UL) {
dev_dbg(ACRN_DBG_PROFILING,
"%s: socwatch start collection invoked!", __func__);
for (i = 0U; i < (uint64_t)MAX_SOCWATCH_FEATURE_ID; i++) {
if (socwatch_collection_switch & (0x1U << i)) {
for (i = 0U; i < (uint16_t)MAX_SOCWATCH_FEATURE_ID; i++) {
if ((socwatch_collection_switch & (0x1UL << i)) != 0UL) {
switch (i) {
case SOCWATCH_COMMAND:
break;