git: 9front

Download patch

ref: 187bb7717e4b517bb6e40d993872a65a0325f2e3
parent: 1b7e3d8540da2452bf8f1176e0f7906bd013631c
author: cinap_lenrek <cinap_lenrek@gmx.de>
date: Thu Dec 6 12:19:13 EST 2012

audiohda: dont xspanalloc() Ctlr structure

theres no requirement for the Ctlr structure to be 8 byte aligned.
its not passed to hardware.

--- a/sys/src/9/pc/audiohda.c
+++ b/sys/src/9/pc/audiohda.c
@@ -1468,8 +1468,11 @@
 	if(cards == nil){
 		p = nil;
 		while(p = hdamatch(p)){
-			ctlr = xspanalloc(sizeof(Ctlr), 8, 0);
-			memset(ctlr, 0, sizeof(Ctlr));
+			ctlr = mallocz(sizeof(Ctlr), 1);
+			if(ctlr == nil){
+				print("hda: can't allocate memory\n");
+				return -1;
+			}
 			ctlr->pcidev = p;
 			ctlr->next = cards;
 			cards = ctlr;
--