diff options
author | cinap_lenrek <cinap_lenrek@centraldogma> | 2011-12-12 16:55:26 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@centraldogma> | 2011-12-12 16:55:26 +0100 |
commit | bf3476d661e05208b78f70cdaa5656ff77264d23 (patch) | |
tree | f5c52910b93aa74586740a54f6b2911e95ae96cc /sys/src/9/pc/usbohci.c | |
parent | 589f99915eb95d9207c08259c8880675a0a502cf (diff) |
kernel: fix inproper use of malloc/smalloc
Diffstat (limited to 'sys/src/9/pc/usbohci.c')
-rw-r--r-- | sys/src/9/pc/usbohci.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/sys/src/9/pc/usbohci.c b/sys/src/9/pc/usbohci.c index fc7f9f2bd..1b9c3cf0c 100644 --- a/sys/src/9/pc/usbohci.c +++ b/sys/src/9/pc/usbohci.c @@ -2383,15 +2383,19 @@ scanpci(void) dprint("ohci: %x/%x port 0x%lux size 0x%x irq %d\n", p->vid, p->did, mem, p->mem[0].size, p->intl); if(mem == 0){ - print("ohci: failed to map registers\n"); + print("usbohci: failed to map registers\n"); continue; } if(p->intl == 0xFF || p->intl == 0) { - print("ohci: no irq assigned for port %#lux\n", mem); + print("usbohci: no irq assigned for port %#lux\n", mem); continue; } - ctlr = smalloc(sizeof(Ctlr)); + ctlr = malloc(sizeof(Ctlr)); + if(ctlr == nil){ + print("usbohci: no memory\n"); + continue; + } ctlr->pcidev = p; ctlr->ohci = vmap(mem, p->mem[0].size); dprint("scanpci: ctlr %#p, ohci %#p\n", ctlr, ctlr->ohci); @@ -2403,7 +2407,7 @@ scanpci(void) break; } if(i == Nhcis) - print("ohci: bug: no more controllers\n"); + print("usbohci: bug: no more controllers\n"); } } |