lib: os: various places fix missing final else
The lib/os/ had several places missing final else statement in the if else if construct. This commit adds else {} or simple refactor to comply with coding guideline 15.7. - cbprintf_complete.c - cbprintf_nano.c - heap-validate.c - heap.c - onoff.c - p4wq.c - sem.c Also resolves the checkpatch issue of comments should align * on each line. Signed-off-by: Jennifer Williams <jennifer.m.williams@intel.com>
This commit is contained in:
parent
c00bdcf1a8
commit
163b7f0d82
7 changed files with 65 additions and 42 deletions
|
@ -557,6 +557,8 @@ int_conv:
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -586,6 +588,8 @@ int_conv:
|
||||||
} else if ((conv->length_mod != LENGTH_NONE)
|
} else if ((conv->length_mod != LENGTH_NONE)
|
||||||
&& (conv->length_mod != LENGTH_UPPER_L)) {
|
&& (conv->length_mod != LENGTH_UPPER_L)) {
|
||||||
conv->invalid = true;
|
conv->invalid = true;
|
||||||
|
} else {
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -802,6 +806,8 @@ static char *encode_uint(uint_value_type value,
|
||||||
conv->altform_0 = true;
|
conv->altform_0 = true;
|
||||||
} else if (radix == 16) {
|
} else if (radix == 16) {
|
||||||
conv->altform_0c = true;
|
conv->altform_0c = true;
|
||||||
|
} else {
|
||||||
|
;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -878,6 +884,8 @@ static char *encode_float(double value,
|
||||||
*sign = '+';
|
*sign = '+';
|
||||||
} else if (conv->flag_space) {
|
} else if (conv->flag_space) {
|
||||||
*sign = ' ';
|
*sign = ' ';
|
||||||
|
} else {
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Extract the non-negative offset exponent and fraction. Record
|
/* Extract the non-negative offset exponent and fraction. Record
|
||||||
|
@ -1383,21 +1391,23 @@ int cbvprintf(cbprintf_cb out, void *ctx, const char *fp, va_list ap)
|
||||||
/* If dynamic width is specified, process it,
|
/* If dynamic width is specified, process it,
|
||||||
* otherwise set with if present.
|
* otherwise set with if present.
|
||||||
*/
|
*/
|
||||||
|
if (conv->width_present) {
|
||||||
if (conv->width_star) {
|
if (conv->width_star) {
|
||||||
width = va_arg(ap, int);
|
width = va_arg(ap, int);
|
||||||
|
|
||||||
if (width < 0) {
|
if (width < 0) {
|
||||||
conv->flag_dash = true;
|
conv->flag_dash = true;
|
||||||
width = -width;
|
width = -width;
|
||||||
}
|
}
|
||||||
} else if (conv->width_present) {
|
} else {
|
||||||
width = conv->width_value;
|
width = conv->width_value;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* If dynamic precision is specified, process it, otherwise
|
/* If dynamic precision is specified, process it, otherwise
|
||||||
* set precision if present. For floating point where
|
* set precision if present. For floating point where
|
||||||
* precision is not present use 6.
|
* precision is not present use 6.
|
||||||
*/
|
*/
|
||||||
|
if (conv->prec_present) {
|
||||||
if (conv->prec_star) {
|
if (conv->prec_star) {
|
||||||
int arg = va_arg(ap, int);
|
int arg = va_arg(ap, int);
|
||||||
|
|
||||||
|
@ -1406,9 +1416,10 @@ int cbvprintf(cbprintf_cb out, void *ctx, const char *fp, va_list ap)
|
||||||
} else {
|
} else {
|
||||||
precision = arg;
|
precision = arg;
|
||||||
}
|
}
|
||||||
} else if (conv->prec_present) {
|
} else {
|
||||||
precision = conv->prec_value;
|
precision = conv->prec_value;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Reuse width and precision memory in conv for value
|
/* Reuse width and precision memory in conv for value
|
||||||
* padding counts.
|
* padding counts.
|
||||||
|
|
|
@ -204,6 +204,8 @@ start:
|
||||||
} else if (special == '+') {
|
} else if (special == '+') {
|
||||||
prefix = "+";
|
prefix = "+";
|
||||||
min_width--;
|
min_width--;
|
||||||
|
} else {
|
||||||
|
;
|
||||||
}
|
}
|
||||||
data_len = convert_value(d, 10, 0, buf + sizeof(buf));
|
data_len = convert_value(d, 10, 0, buf + sizeof(buf));
|
||||||
data = buf + sizeof(buf) - data_len;
|
data = buf + sizeof(buf) - data_len;
|
||||||
|
|
|
@ -207,7 +207,7 @@ static bool rand_alloc_choice(struct z_heap_stress_rec *sr)
|
||||||
return true;
|
return true;
|
||||||
} else if (sr->blocks_alloced >= sr->nblocks) {
|
} else if (sr->blocks_alloced >= sr->nblocks) {
|
||||||
return false;
|
return false;
|
||||||
}
|
} else {
|
||||||
|
|
||||||
/* The way this works is to scale the chance of choosing to
|
/* The way this works is to scale the chance of choosing to
|
||||||
* allocate vs. free such that it's even odds when the heap is
|
* allocate vs. free such that it's even odds when the heap is
|
||||||
|
@ -234,6 +234,7 @@ static bool rand_alloc_choice(struct z_heap_stress_rec *sr)
|
||||||
}
|
}
|
||||||
|
|
||||||
return rand32() > free_chance;
|
return rand32() > free_chance;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Chooses a size of block to allocate, logarithmically favoring
|
/* Chooses a size of block to allocate, logarithmically favoring
|
||||||
|
|
|
@ -361,6 +361,8 @@ void *sys_heap_aligned_realloc(struct sys_heap *heap, void *ptr,
|
||||||
merge_chunks(h, c, rc);
|
merge_chunks(h, c, rc);
|
||||||
set_chunk_used(h, c, true);
|
set_chunk_used(h, c, true);
|
||||||
return ptr;
|
return ptr;
|
||||||
|
} else {
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fallback: allocate and copy */
|
/* Fallback: allocate and copy */
|
||||||
|
|
|
@ -222,6 +222,8 @@ static int process_recheck(struct onoff_manager *mgr)
|
||||||
} else if ((state == ONOFF_STATE_ERROR)
|
} else if ((state == ONOFF_STATE_ERROR)
|
||||||
&& !sys_slist_is_empty(&mgr->clients)) {
|
&& !sys_slist_is_empty(&mgr->clients)) {
|
||||||
evt = EVT_RESET;
|
evt = EVT_RESET;
|
||||||
|
} else {
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
return evt;
|
return evt;
|
||||||
|
@ -406,6 +408,8 @@ static void process_event(struct onoff_manager *mgr,
|
||||||
} else if ((mgr->flags & ONOFF_FLAG_RECHECK) != 0) {
|
} else if ((mgr->flags & ONOFF_FLAG_RECHECK) != 0) {
|
||||||
mgr->flags &= ~ONOFF_FLAG_RECHECK;
|
mgr->flags &= ~ONOFF_FLAG_RECHECK;
|
||||||
evt = EVT_RECHECK;
|
evt = EVT_RECHECK;
|
||||||
|
} else {
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
state = mgr->flags & ONOFF_STATE_MASK;
|
state = mgr->flags & ONOFF_STATE_MASK;
|
||||||
|
|
|
@ -63,6 +63,8 @@ static inline bool item_lessthan(struct k_p4wq_work *a, struct k_p4wq_work *b)
|
||||||
} else if ((a->priority == b->priority) &&
|
} else if ((a->priority == b->priority) &&
|
||||||
(a->deadline != b->deadline)) {
|
(a->deadline != b->deadline)) {
|
||||||
return a->deadline - b->deadline > 0;
|
return a->deadline - b->deadline > 0;
|
||||||
|
} else {
|
||||||
|
;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,8 +74,9 @@ int sys_sem_give(struct sys_sem *sem)
|
||||||
}
|
}
|
||||||
} else if (old_value >= sem->limit) {
|
} else if (old_value >= sem->limit) {
|
||||||
return -EAGAIN;
|
return -EAGAIN;
|
||||||
|
} else {
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue