mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2026-06-08 18:14:53 +00:00
dm: platform: clean up assert() for some platform devices
Tracked-On: #3252 Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com> Reviewed-by: Yonghua Huang <yonghua.huang@intel.com>
This commit is contained in:
@@ -26,7 +26,6 @@
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
@@ -43,6 +42,7 @@
|
||||
#include "ps2mouse.h"
|
||||
#include "vmmapi.h"
|
||||
#include "mevent.h"
|
||||
#include "log.h"
|
||||
|
||||
static void
|
||||
atkbdc_assert_kbd_intr(struct atkbdc_base *base)
|
||||
@@ -291,7 +291,7 @@ atkbdc_sts_ctl_handler(struct vmctx *ctx, int vcpu, int in, int port,
|
||||
int bytes, uint32_t *eax, void *arg)
|
||||
{
|
||||
struct atkbdc_base *base;
|
||||
int error, retval;
|
||||
int retval;
|
||||
|
||||
if (bytes != 1)
|
||||
return -1;
|
||||
@@ -361,9 +361,8 @@ atkbdc_sts_ctl_handler(struct vmctx *ctx, int vcpu, int in, int port,
|
||||
KBDS_KBD_BUFFER_FULL;
|
||||
break;
|
||||
case KBDC_RESET: /* Pulse "cold reset" line */
|
||||
error = vm_suspend(ctx, VM_SUSPEND_FULL_RESET);
|
||||
vm_suspend(ctx, VM_SUSPEND_FULL_RESET);
|
||||
mevent_notify();
|
||||
assert(error == 0 || errno == EALREADY);
|
||||
break;
|
||||
default:
|
||||
if (*eax >= 0x21 && *eax <= 0x3f) {
|
||||
@@ -415,8 +414,10 @@ atkbdc_init(struct vmctx *ctx)
|
||||
int error;
|
||||
|
||||
base = calloc(1, sizeof(struct atkbdc_base));
|
||||
|
||||
assert(base != NULL);
|
||||
if (!base) {
|
||||
pr_err("%s: alloc memory fail!\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
base->ctx = ctx;
|
||||
ctx->atkbdc_base = base;
|
||||
@@ -432,7 +433,8 @@ atkbdc_init(struct vmctx *ctx)
|
||||
iop.arg = base;
|
||||
|
||||
error = register_inout(&iop);
|
||||
assert(error == 0);
|
||||
if (error < 0)
|
||||
goto fail;
|
||||
|
||||
bzero(&iop, sizeof(struct inout_port));
|
||||
iop.name = "atkdbc";
|
||||
@@ -443,7 +445,8 @@ atkbdc_init(struct vmctx *ctx)
|
||||
iop.arg = base;
|
||||
|
||||
error = register_inout(&iop);
|
||||
assert(error == 0);
|
||||
if (error < 0)
|
||||
goto fail;
|
||||
|
||||
pci_irq_reserve(KBD_DEV_IRQ);
|
||||
base->kbd.irq = KBD_DEV_IRQ;
|
||||
@@ -453,6 +456,11 @@ atkbdc_init(struct vmctx *ctx)
|
||||
|
||||
base->ps2kbd = ps2kbd_init(base);
|
||||
base->ps2mouse = ps2mouse_init(base);
|
||||
|
||||
return;
|
||||
fail:
|
||||
pr_err("%s: fail to init!\n", __func__);
|
||||
free(base);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user