mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-23 01:37:44 +00:00
HV:change the return type of sbuf_get and sbuf_put
Because of the return type inconsistent,change the sbuf return type to uint32_t to fix it,and make the pre-condition to check the parameter whether is NULL. V1->V2: 1.add () to bool expression 2.add pre-assumption to sbuf_get and sbuf_put Tracked-On: #861 Signed-off-by: Huihuang Shi <huihuang.shi@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
@@ -174,7 +174,7 @@ void do_logmsg(uint32_t severity, const char *fmt, ...)
|
||||
void print_logmsg_buffer(uint16_t pcpu_id)
|
||||
{
|
||||
char buffer[LOG_ENTRY_SIZE + 1];
|
||||
int read_cnt;
|
||||
uint32_t read_cnt;
|
||||
struct shared_buf **sbuf;
|
||||
int is_earlylog = 0;
|
||||
uint64_t rflags;
|
||||
@@ -203,13 +203,13 @@ void print_logmsg_buffer(uint16_t pcpu_id)
|
||||
uint32_t idx;
|
||||
(void)memset(buffer, 0U, LOG_ENTRY_SIZE + 1U);
|
||||
|
||||
if (*sbuf == NULL) {
|
||||
if ((*sbuf == NULL) || (buffer == NULL)) {
|
||||
return;
|
||||
}
|
||||
|
||||
read_cnt = sbuf_get(*sbuf, (uint8_t *)buffer);
|
||||
|
||||
if (read_cnt <= 0) {
|
||||
if (read_cnt == 0U) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -220,5 +220,5 @@ void print_logmsg_buffer(uint16_t pcpu_id)
|
||||
spinlock_irqsave_obtain(&(logmsg.lock), &rflags);
|
||||
printf("%s\n\r", buffer);
|
||||
spinlock_irqrestore_release(&(logmsg.lock), rflags);
|
||||
} while (read_cnt > 0);
|
||||
} while (read_cnt > 0U);
|
||||
}
|
||||
|
Reference in New Issue
Block a user