--- trunk/src/devices/dev_ns16550.c 2007/10/08 16:21:17 34 +++ trunk/src/devices/dev_ns16550.c 2007/10/08 16:22:32 42 @@ -25,10 +25,9 @@ * SUCH DAMAGE. * * - * $Id: dev_ns16550.c,v 1.58 2006/12/30 13:30:58 debug Exp $ + * $Id: dev_ns16550.c,v 1.62 2007/06/15 19:57:33 debug Exp $ * - * NS16550 serial controller. - * + * COMMENT: NS16550 serial controller * * TODO: Implement the FIFO. */ @@ -322,14 +321,11 @@ DEVINIT(ns16550) { - struct ns_data *d = malloc(sizeof(struct ns_data)); + struct ns_data *d; size_t nlen; char *name; - if (d == NULL) { - fprintf(stderr, "out of memory\n"); - exit(1); - } + CHECK_ALLOCATION(d = malloc(sizeof(struct ns_data))); memset(d, 0, sizeof(struct ns_data)); d->addrmult = devinit->addr_mult; @@ -350,11 +346,7 @@ nlen = strlen(devinit->name) + 10; if (devinit->name2 != NULL) nlen += strlen(devinit->name2); - name = malloc(nlen); - if (name == NULL) { - fprintf(stderr, "out of memory\n"); - exit(1); - } + CHECK_ALLOCATION(name = malloc(nlen)); if (devinit->name2 != NULL && devinit->name2[0]) snprintf(name, nlen, "%s [%s]", devinit->name, devinit->name2); else @@ -364,11 +356,11 @@ DEV_NS16550_LENGTH * d->addrmult, dev_ns16550_access, d, DM_DEFAULT, NULL); machine_add_tickfunction(devinit->machine, - dev_ns16550_tick, d, TICK_SHIFT, 0.0); + dev_ns16550_tick, d, TICK_SHIFT); /* * NOTE: Ugly cast into a pointer, because this is a convenient way - * to return the console handle to code in src/machine.c. + * to return the console handle to code in src/machines/. */ devinit->return_ptr = (void *)(size_t)d->console_handle;