@@ -32,14 +32,15 @@ uint32_t console_loglevel = CONFIG_CONSOLE_LOGLEVEL_DEFAULT;
32
32
uint32_t mem_loglevel = CONFIG_MEM_LOGLEVEL_DEFAULT ;
33
33
34
34
static int string_to_argv (char * argv_str , void * p_argv_mem ,
35
- __unused uint32_t argv_mem_size , int * p_argc , char * * * p_argv )
35
+ __unused uint32_t argv_mem_size ,
36
+ uint32_t * p_argc , char * * * p_argv )
36
37
{
37
38
uint32_t argc ;
38
39
char * * argv ;
39
40
char * p_ch ;
40
41
41
42
/* Setup initial argument values. */
42
- argc = 0 ;
43
+ argc = 0U ;
43
44
argv = NULL ;
44
45
45
46
/* Ensure there are arguments to be processed. */
@@ -103,7 +104,7 @@ static uint8_t shell_input_line(struct shell *p_shell)
103
104
/* Backspace */
104
105
case '\b' :
105
106
/* Ensure length is not 0 */
106
- if (p_shell -> input_line_len > 0 ) {
107
+ if (p_shell -> input_line_len > 0U ) {
107
108
/* Reduce the length of the string by one */
108
109
p_shell -> input_line_len -- ;
109
110
@@ -140,7 +141,7 @@ static uint8_t shell_input_line(struct shell *p_shell)
140
141
done = true;
141
142
142
143
/* Reset command length for next command processing */
143
- p_shell -> input_line_len = 0 ;
144
+ p_shell -> input_line_len = 0U ;
144
145
break ;
145
146
146
147
/* Line feed */
@@ -153,7 +154,7 @@ static uint8_t shell_input_line(struct shell *p_shell)
153
154
/* Ensure data doesn't exceed full terminal width */
154
155
if (p_shell -> input_line_len < SHELL_CMD_MAX_LEN ) {
155
156
/* See if a "standard" prINTable ASCII character received */
156
- if ((ch >= 32 ) && (ch <= 126 )) {
157
+ if ((ch >= 32U ) && (ch <= 126U )) {
157
158
/* Add character to string */
158
159
p_shell -> input_line [p_shell -> input_line_active ]
159
160
[p_shell -> input_line_len ] = ch ;
@@ -187,7 +188,7 @@ static uint8_t shell_input_line(struct shell *p_shell)
187
188
done = true;
188
189
189
190
/* Reset command length for next command processing */
190
- p_shell -> input_line_len = 0 ;
191
+ p_shell -> input_line_len = 0U ;
191
192
192
193
}
193
194
break ;
@@ -225,7 +226,7 @@ static int shell_process(struct shell *p_shell)
225
226
226
227
/* Now that the command is processed, zero fill the input buffer */
227
228
memset ((void * ) p_shell -> input_line [p_shell -> input_line_active ], 0 ,
228
- SHELL_CMD_MAX_LEN + 1 );
229
+ SHELL_CMD_MAX_LEN + 1U );
229
230
230
231
/* Process command and return result to caller */
231
232
return status ;
@@ -236,10 +237,10 @@ struct shell_cmd *shell_find_cmd(struct shell *p_shell, const char *cmd_str)
236
237
uint32_t i ;
237
238
struct shell_cmd * p_cmd = NULL ;
238
239
239
- if (p_shell -> cmd_count <= 0 )
240
+ if (p_shell -> cmd_count <= 0U )
240
241
return NULL ;
241
242
242
- for (i = 0 ; i < p_shell -> cmd_count ; i ++ ) {
243
+ for (i = 0U ; i < p_shell -> cmd_count ; i ++ ) {
243
244
p_cmd = & p_shell -> shell_cmd [i ];
244
245
if (strcmp (p_cmd -> str , cmd_str ) == 0 )
245
246
break ;
@@ -297,8 +298,8 @@ int shell_process_cmd(struct shell *p_shell, char *p_input_line)
297
298
int status = 0 ;
298
299
struct shell_cmd * p_cmd ;
299
300
shell_cmd_fn_t cmd_fcn ;
300
- char cmd_argv_str [SHELL_CMD_MAX_LEN + 1 ];
301
- int cmd_argv_mem [sizeof (char * ) * ((SHELL_CMD_MAX_LEN + 1 ) / 2 )];
301
+ char cmd_argv_str [SHELL_CMD_MAX_LEN + 1U ];
302
+ int cmd_argv_mem [sizeof (char * ) * ((SHELL_CMD_MAX_LEN + 1U ) / 2U )];
302
303
int cmd_argc ;
303
304
char * * cmd_argv ;
304
305
@@ -360,7 +361,7 @@ int shell_init_serial(struct shell *p_shell)
360
361
361
362
/* Zero fill the input buffer */
362
363
memset ((void * )p_shell -> input_line [p_shell -> input_line_active ], 0 ,
363
- SHELL_CMD_MAX_LEN + 1 );
364
+ SHELL_CMD_MAX_LEN + 1U );
364
365
365
366
return status ;
366
367
}
@@ -383,14 +384,14 @@ int shell_cmd_help(struct shell *p_shell,
383
384
384
385
memset (space_buf , ' ' , sizeof (space_buf ));
385
386
/* Proceed based on the number of registered commands. */
386
- if (p_shell -> cmd_count == 0 ) {
387
+ if (p_shell -> cmd_count == 0U ) {
387
388
/* No registered commands */
388
389
shell_puts (p_shell , "NONE\r\n" );
389
390
} else {
390
- int i = 0 ;
391
+ int32_t i = 0 ;
391
392
uint32_t j ;
392
393
393
- for (j = 0 ; j < p_shell -> cmd_count ; j ++ ) {
394
+ for (j = 0U ; j < p_shell -> cmd_count ; j ++ ) {
394
395
p_cmd = & p_shell -> shell_cmd [j ];
395
396
396
397
/* Check if we've filled the screen with info */
@@ -733,28 +734,28 @@ int shell_vcpu_dumpreg(struct shell *p_shell,
733
734
vm_id , cur_context -> rsp );
734
735
shell_puts (p_shell , temp_str );
735
736
736
- for (i = 0 ; i < 8 ; i ++ ) {
737
+ for (i = 0UL ; i < 8UL ; i ++ ) {
737
738
snprintf (temp_str , MAX_STR_SIZE ,
738
739
"= 0x%016llx 0x%016llx "
739
740
"0x%016llx 0x%016llx\r\n" ,
740
- tmp [i * 4 ], tmp [i * 4 + 1 ],
741
- tmp [i * 4 + 2 ], tmp [i * 4 + 3 ]);
741
+ tmp [i * 4UL ], tmp [i * 4UL + 1UL ],
742
+ tmp [i * 4UL + 2UL ], tmp [i * 4UL + 3UL ]);
742
743
shell_puts (p_shell , temp_str );
743
744
}
744
745
}
745
746
746
747
return status ;
747
748
}
748
749
749
- #define MAX_MEMDUMP_LEN (32*8 )
750
+ #define MAX_MEMDUMP_LEN (32U*8U )
750
751
int shell_vcpu_dumpmem (struct shell * p_shell ,
751
752
int argc , char * * argv )
752
753
{
753
754
int status = 0 ;
754
755
uint32_t vm_id , vcpu_id ;
755
756
uint64_t gva ;
756
757
uint64_t tmp [MAX_MEMDUMP_LEN /8 ];
757
- uint32_t i , length = 32 ;
758
+ uint32_t i , length = 32U ;
758
759
char temp_str [MAX_STR_SIZE ];
759
760
struct vm * vm ;
760
761
struct vcpu * vcpu ;
@@ -802,14 +803,14 @@ int shell_vcpu_dumpmem(struct shell *p_shell,
802
803
"length %d:\r\n" , vcpu_id , gva , length );
803
804
shell_puts (p_shell , temp_str );
804
805
805
- for (i = 0 ; i < length /32 ; i ++ ) {
806
+ for (i = 0U ; i < length /32U ; i ++ ) {
806
807
snprintf (temp_str , MAX_STR_SIZE ,
807
808
"= 0x%016llx 0x%016llx 0x%016llx "
808
809
"0x%016llx\r\n" , tmp [i * 4 ], tmp [i * 4 + 1 ],
809
810
tmp [i * 4 + 2 ], tmp [i * 4 + 3 ]);
810
811
shell_puts (p_shell , temp_str );
811
812
}
812
- if (length > 32 * ( length / 32 ) ) {
813
+ if (( length % 32U ) != 0 ) {
813
814
snprintf (temp_str , MAX_STR_SIZE ,
814
815
"= 0x%016llx 0x%016llx 0x%016llx "
815
816
"0x%016llx\r\n" , tmp [i * 4 ], tmp [i * 4 + 1 ],
@@ -1095,7 +1096,7 @@ void shell_special_serial(struct shell *p_shell, uint8_t ch)
1095
1096
{
1096
1097
switch (ch ) {
1097
1098
/* Escape character */
1098
- case 0x1b :
1099
+ case 0x1bU :
1099
1100
/* Consume the next 2 characters */
1100
1101
(void ) p_shell -> session_io .io_getc (p_shell );
1101
1102
(void ) p_shell -> session_io .io_getc (p_shell );
0 commit comments