HV: Fix new MISRAC violations for brackets

Fix remaining 11S and 12S violations. These
are after the 7 patches submitted earlier.

Signed-off-by: Arindam Roy <arindam.roy@intel.com>
This commit is contained in:
Arindam Roy
2018-07-12 16:46:07 -07:00
committed by lijinxia
parent 90b342bd53
commit 944776f238
19 changed files with 123 additions and 70 deletions

View File

@@ -64,8 +64,9 @@ static void *allocate_mem(struct mem_pool *pool, unsigned int num_bytes)
uint32_t requested_buffs;
/* Check if provided memory pool exists */
if (pool == NULL)
if (pool == NULL) {
return NULL;
}
/* Acquire the pool lock */
spinlock_obtain(&pool->spinlock);
@@ -102,8 +103,9 @@ static void *allocate_mem(struct mem_pool *pool, unsigned int num_bytes)
* out-of-range
*/
tmp_idx++;
if (tmp_idx == pool->bmp_size)
if (tmp_idx == pool->bmp_size) {
break;
}
/* Reset tmp_bit_idx */
tmp_bit_idx = 0U;
}
@@ -424,8 +426,9 @@ void *memset(void *base, uint8_t v, size_t n)
dest_p = (uint8_t *)base;
if ((dest_p == NULL) || (n == 0U))
if ((dest_p == NULL) || (n == 0U)) {
return NULL;
}
/*do the few bytes to get uint64_t alignment*/
count = n;

View File

@@ -229,8 +229,9 @@ static int format_number(struct print_param *param)
/* emit prefix, return early if an error occurred */
res = param->emit(PRINT_CMD_COPY, param->vars.prefix,
param->vars.prefixlen, param->data);
if ((param->vars.prefix != NULL) && (res < 0))
if ((param->vars.prefix != NULL) && (res < 0)) {
return res;
}
/* invalidate prefix */
param->vars.prefix = NULL;
@@ -241,8 +242,9 @@ static int format_number(struct print_param *param)
* an error occurred
*/
res = param->emit(PRINT_CMD_FILL, &pad, w, param->data);
if (res < 0)
if (res < 0) {
return res;
}
}
/* emit prefix (if any), return early in case of an error */
@@ -271,8 +273,9 @@ static int format_number(struct print_param *param)
if ((param->vars.flags & PRINT_FLAG_LEFT_JUSTIFY) != 0) {
/* emit trailing blanks, return early in case of an error */
res = param->emit(PRINT_CMD_FILL, " ", w, param->data);
if (res < 0)
if (res < 0) {
return res;
}
}
/* done, return the last result */
@@ -520,8 +523,9 @@ int do_print(const char *fmt, struct print_param *param,
if (*fmt == '.') {
fmt++;
fmt = get_int(fmt, &(param->vars.precision));
if (param->vars.precision < 0)
if (param->vars.precision < 0) {
param->vars.precision = 0;
}
}
fmt = get_length_modifier(fmt, &(param->vars.flags),

View File

@@ -85,8 +85,7 @@ long strtol_deci(const char *nptr)
if (any < 0) {
acc = (neg != 0) ? LONG_MIN : LONG_MAX;
}
else if (neg != 0) {
} else if (neg != 0) {
acc = -acc;
}
return acc;
@@ -123,14 +122,11 @@ uint64_t strtoul_hex(const char *nptr)
do {
if (c >= '0' && c <= '9') {
c -= '0';
}
else if (c >= 'A' && c <= 'F') {
} else if (c >= 'A' && c <= 'F') {
c -= 'A' - 10;
}
else if (c >= 'a' && c <= 'f') {
} else if (c >= 'a' && c <= 'f') {
c -= 'a' - 10;
}
else {
} else {
break;
}
if (c >= base) {
@@ -138,8 +134,7 @@ uint64_t strtoul_hex(const char *nptr)
}
if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim)) {
any = -1;
}
else {
} else {
any = 1;
acc *= base;
acc += c;
@@ -220,8 +215,9 @@ char *strcpy_s(char *d, size_t dmax, const char *s)
}
*d = *s;
if (*d == '\0')
if (*d == '\0') {
return dest_base;
}
d++;
s++;
@@ -347,8 +343,9 @@ size_t strnlen_s(const char *str, size_t maxlen)
{
size_t count;
if (str == NULL)
if (str == NULL) {
return 0;
}
count = 0U;
while ((*str) != 0) {