Skip to content

Commit 2d03706

Browse files
mingqiangchijren1
authored andcommitted
hv:change shell_puts to void type
Change this function to void type Remove some parameters check, add these checks as preconditions Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
1 parent 4cab8b9 commit 2d03706

File tree

2 files changed

+9
-16
lines changed

2 files changed

+9
-16
lines changed

hypervisor/debug/shell_internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ uint8_t shell_getc_serial(struct shell *p_shell);
170170
void shell_special_serial(struct shell *p_shell, uint8_t ch);
171171
void kick_shell(struct shell *p_shell);
172172

173-
int shell_puts(struct shell *p_shell, const char *str_ptr);
173+
void shell_puts(struct shell *p_shell, const char *str_ptr);
174174
int shell_set_name(struct shell *p_shell, const char *name);
175175
int shell_trigger_crash(struct shell *p_shell, int argc, char **argv);
176176

hypervisor/debug/shell_public.c

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -159,23 +159,16 @@ int shell_init(void)
159159
return status;
160160
}
161161

162-
int shell_puts(struct shell *p_shell, const char *str_ptr)
162+
/**
163+
* @pre p_shell != NULL
164+
* @pre p_shell->session_io.io_puts != NULL
165+
* @pre str_ptr != NULL
166+
*/
167+
void shell_puts(struct shell *p_shell, const char *str_ptr)
163168
{
164-
int status;
165-
166-
if ((p_shell != NULL) && (p_shell->session_io.io_puts != NULL) &&
167-
(str_ptr != NULL)) {
168-
/* Transmit data using this shell session's 'puts' function */
169-
p_shell->session_io.io_puts(p_shell, str_ptr);
170-
171-
status = 0;
172-
} else {
173-
/* Error: Invalid request */
174-
status = -EINVAL;
169+
/* Transmit data using this shell session's 'puts' function */
170+
p_shell->session_io.io_puts(p_shell, str_ptr);
175171

176-
}
177-
178-
return status;
179172
}
180173

181174
int shell_set_name(struct shell *p_shell, const char *name)

0 commit comments

Comments
 (0)