dm: refine assert usage

Remove unnecessary assert and add error handling when required.

Tracked-On: #3252
Signed-off-by: Jian Jun Chen <jian.jun.chen@intel.com>
Reviewed-by: Shuo A Liu <shuo.a.liu@intel.com>
This commit is contained in:
Jian Jun Chen
2019-06-18 13:38:37 +08:00
committed by ACRN System Integration
parent 0a8bf6cee4
commit 56469f3edc
4 changed files with 26 additions and 33 deletions

View File

@@ -30,7 +30,6 @@
* Micro event library for FreeBSD, designed for a single i/o thread
* using EPOLL, and having events be persistent by default.
*/
#include <assert.h>
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
@@ -377,7 +376,6 @@ int
mevent_init(void)
{
epoll_fd = epoll_create1(0);
assert(epoll_fd >= 0);
if (epoll_fd >= 0)
return 0;
@@ -420,7 +418,10 @@ mevent_dispatch(void)
* Add internal event handler for the pipe write fd
*/
pipev = mevent_add(mevent_pipefd[0], EVF_READ, mevent_pipe_read, NULL, NULL, NULL);
assert(pipev != NULL);
if (!pipev) {
fprintf(stderr, "pipefd mevent_add failed\n");
exit(0);
}
for (;;) {
int suspend_mode;