summaryrefslogtreecommitdiff
path: root/sys/src/9/pc/devfloppy.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@centraldogma>2011-12-14 00:22:46 +0100
committercinap_lenrek <cinap_lenrek@centraldogma>2011-12-14 00:22:46 +0100
commit9310f981b0a0c1b854d86d5b0e59bb90eb4beedc (patch)
tree3ab3606a824876bcff236c37a3197cec4515f963 /sys/src/9/pc/devfloppy.c
parent861713765bd5abf661fd11d33dbb0bc90a7a2e23 (diff)
kernel: xalloc error handling
Diffstat (limited to 'sys/src/9/pc/devfloppy.c')
-rw-r--r--sys/src/9/pc/devfloppy.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/sys/src/9/pc/devfloppy.c b/sys/src/9/pc/devfloppy.c
index 00323073e..9ff866529 100644
--- a/sys/src/9/pc/devfloppy.c
+++ b/sys/src/9/pc/devfloppy.c
@@ -181,17 +181,25 @@ floppyreset(void)
}
/*
- * Should check if this fails. Can do so
- * if there is no space <= 16MB for the DMA
+ * Can fail if there is no space <= 16MB for the DMA
* bounce buffer.
*/
- dmainit(DMAchan, maxtsize);
+ if(dmainit(DMAchan, maxtsize)){
+ print("floppy: dmainit failed\n");
+ fl.ndrive = 0;
+ return;
+ }
/*
* allocate the drive storage
*/
fl.d = xalloc(fl.ndrive*sizeof(FDrive));
fl.selected = fl.d;
+ if(fl.d == nil){
+ print("floppy: can't allocate memory\n");
+ fl.ndrive = 0;
+ return;
+ }
/*
* stop the motors