mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-07-31 15:30:56 +00:00
HV: add the missing brackets to loop body
MISRA-C requires the use of brackets, even when there is only one statement in the loop body. Signed-off-by: Ying Liu <ying2.liu@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
parent
fd81655e60
commit
8c43ad54bf
@ -38,12 +38,14 @@ static void parse_other_modules(struct vm *vm,
|
||||
dev_dbg(ACRN_DBG_BOOT, "cmd addr=0x%x, str=%s",
|
||||
mods[i].mm_string, start);
|
||||
|
||||
while (*start == ' ')
|
||||
while (*start == ' ') {
|
||||
start++;
|
||||
}
|
||||
|
||||
end = start;
|
||||
while (*end != ' ' && (*end) != 0)
|
||||
while (*end != ' ' && (*end) != 0) {
|
||||
end++;
|
||||
}
|
||||
|
||||
type_len = end - start;
|
||||
if (strncmp("FIRMWARE", start, type_len) == 0) {
|
||||
|
@ -67,8 +67,9 @@ int console_puts(const char *s)
|
||||
*/
|
||||
p = s;
|
||||
|
||||
while ((*p != 0) && *p != '\n')
|
||||
while ((*p != 0) && *p != '\n') {
|
||||
++p;
|
||||
}
|
||||
|
||||
/* write all characters up to p */
|
||||
serial_puts(serial_handle, s, p - s);
|
||||
@ -109,8 +110,9 @@ int console_write(const char *s, size_t len)
|
||||
/* search for '\n' or the end of the string */
|
||||
p = s;
|
||||
|
||||
while ((p != e) && (*p != '\n'))
|
||||
while ((p != e) && (*p != '\n')) {
|
||||
++p;
|
||||
}
|
||||
|
||||
/* write all characters processed so far */
|
||||
serial_puts(serial_handle, s, p - s);
|
||||
@ -146,8 +148,9 @@ void console_dump_bytes(const void *p, unsigned int len)
|
||||
/* write the address of the first byte in the row */
|
||||
printf("%08x: ", (uint64_t) x);
|
||||
/* print one row (16 bytes) as hexadecimal values */
|
||||
for (i = 0; i < 16; i++)
|
||||
for (i = 0; i < 16; i++) {
|
||||
printf("%02x ", x[i]);
|
||||
}
|
||||
|
||||
/* print one row as ASCII characters (if possible) */
|
||||
for (i = 0; i < 16; i++) {
|
||||
|
@ -76,8 +76,9 @@ void init_logmsg(__unused uint32_t mem_size, uint32_t flags)
|
||||
logmsg.seq = 0;
|
||||
|
||||
/* allocate sbuf for log before sos booting */
|
||||
for (pcpu_id = 0U; pcpu_id < phys_cpu_num; pcpu_id++)
|
||||
for (pcpu_id = 0U; pcpu_id < phys_cpu_num; pcpu_id++) {
|
||||
alloc_earlylog_sbuf(pcpu_id);
|
||||
}
|
||||
}
|
||||
|
||||
void do_logmsg(uint32_t severity, const char *fmt, ...)
|
||||
|
@ -332,8 +332,9 @@ int serial_puts(uint32_t uart_handle, const char *s, uint32_t length)
|
||||
* Loop through the string until desired length of bytes have
|
||||
* been written or SERIAL_EOF is returned.
|
||||
*/
|
||||
for (; length > 0U && retval != SERIAL_EOF; s++, length--)
|
||||
for (; length > 0U && retval != SERIAL_EOF; s++, length--) {
|
||||
retval = serial_putc(uart_handle, (int) *s);
|
||||
}
|
||||
|
||||
/* Allow other threads to use this service. */
|
||||
spinlock_release(&port->tx_lock);
|
||||
|
@ -66,8 +66,9 @@ static int string_to_argv(char *argv_str, void *p_argv_mem,
|
||||
/* Move past the vector entry argument string (in the
|
||||
* argument string).
|
||||
*/
|
||||
while ((*p_ch != ' ') && (*p_ch != ',') && (*p_ch != 0))
|
||||
while ((*p_ch != ' ') && (*p_ch != ',') && (*p_ch != 0)) {
|
||||
p_ch++;
|
||||
}
|
||||
|
||||
/* Count the argument just processed. */
|
||||
argc++;
|
||||
@ -80,10 +81,11 @@ static int string_to_argv(char *argv_str, void *p_argv_mem,
|
||||
*p_ch = 0;
|
||||
/* Remove all space in middile of cmdline */
|
||||
p_ch++;
|
||||
while (*p_ch == ' ')
|
||||
while (*p_ch == ' ') {
|
||||
p_ch++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Update return parameters */
|
||||
*p_argc = argc;
|
||||
|
@ -322,8 +322,9 @@ void vuart_console_tx_chars(void)
|
||||
return;
|
||||
|
||||
vuart_lock(vu);
|
||||
while (fifo_numchars(&vu->txfifo) > 0)
|
||||
while (fifo_numchars(&vu->txfifo) > 0) {
|
||||
printf("%c", fifo_getchar(&vu->txfifo));
|
||||
}
|
||||
vuart_unlock(vu);
|
||||
}
|
||||
|
||||
|
@ -170,8 +170,9 @@ TRACE_16STR(uint32_t evid, const char name[])
|
||||
|
||||
len = strnlen_s(name, 20U);
|
||||
len = (len > 16U) ? 16U : len;
|
||||
for (i = 0U; i < len; i++)
|
||||
for (i = 0U; i < len; i++) {
|
||||
entry.payload.str[i] = name[i];
|
||||
}
|
||||
|
||||
entry.payload.str[15] = 0;
|
||||
_trace_put(cpu_id, evid, 16U, &entry);
|
||||
|
@ -469,8 +469,9 @@ int do_print(const char *fmt, struct print_param *param,
|
||||
/* mark the current position and search the next '%' */
|
||||
start = fmt;
|
||||
|
||||
while (((*fmt) != 0) && (*fmt != '%'))
|
||||
while (((*fmt) != 0) && (*fmt != '%')) {
|
||||
fmt++;
|
||||
}
|
||||
|
||||
/*
|
||||
* pass all characters until the next '%' to the emit function.
|
||||
|
@ -150,8 +150,9 @@ int atoi(const char *str)
|
||||
|
||||
char *strchr(const char *s, int ch)
|
||||
{
|
||||
while ((*s != 0) && (*s != ch))
|
||||
while ((*s != 0) && (*s != ch)) {
|
||||
++s;
|
||||
}
|
||||
|
||||
return ((*s) != 0) ? ((char *)s) : 0;
|
||||
}
|
||||
|
@ -15,6 +15,6 @@ void udelay(uint32_t us)
|
||||
dest_tsc = rdtsc() + delta_tsc;
|
||||
|
||||
/* Loop until time expired */
|
||||
while
|
||||
(rdtsc() < dest_tsc);
|
||||
while (rdtsc() < dest_tsc) {
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user