dm: refine 'assert' usage in timer.c and rtc.c

- 'assert' cleanup
 - fix memory leakage in vrtc_init()

Tracked-On: #3252
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
Reviewed-by: Shuo A Liu <shuo.a.liu@intel.com>
This commit is contained in:
Yonghua Huang
2019-06-17 18:18:30 +08:00
committed by wenlingz
parent ec626482d2
commit a2332b159a
2 changed files with 60 additions and 46 deletions

View File

@@ -7,7 +7,6 @@
#include <stdbool.h>
#include <unistd.h>
#include <errno.h>
#include <assert.h>
#include <sys/timerfd.h>
#include "vmmapi.h"
@@ -51,7 +50,9 @@ timer_handler(int fd __attribute__((unused)),
return;
}
assert(size > 0 && nexp > 0);
/* check the validity of timer expiration. */
if ((size == 0) || (nexp == 0))
return;
if ((cb = timer->callback) != NULL) {
(*cb)(timer->callback_param, nexp);