uarti8250: print on malloc failure

This commit is contained in:
cinap_lenrek 2013-05-20 17:43:30 +02:00
parent 3ccf5db688
commit 58201a67c1

View file

@ -621,12 +621,14 @@ i8250alloc(int io, int irq, int tbdf)
{
Ctlr *ctlr;
if((ctlr = malloc(sizeof(Ctlr))) != nil){
ctlr->io = io;
ctlr->irq = irq;
ctlr->tbdf = tbdf;
ctlr = malloc(sizeof(Ctlr));
if(ctlr == nil){
print("i8250alloc: no memory for Ctlr\n");
return nil;
}
ctlr->io = io;
ctlr->irq = irq;
ctlr->tbdf = tbdf;
return ctlr;
}