uarti8250: print on malloc failure
This commit is contained in:
parent
3ccf5db688
commit
58201a67c1
1 changed files with 7 additions and 5 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue