shithub: riscv

Download patch

ref: 14c8343e86d3dfe01c939df550846741c2c9c31b
parent: c33fc43408cb22d606d2f621c34a5748cb0e2bc5
author: Jacob Moody <moody@posixcafe.org>
date: Fri May 26 10:05:11 EDT 2023

kernel: sdram: do not use xalloc for SDev

This was a sleeping bug, the unconfigure
routine was never called so the SDev structure
was never freed. Now that fshalt unconfigures the
drives before powering off, the fact that this was
alloc'd with xalloc causes a panic.
Found by sigrid, tested by sl and myself.

--- a/sys/src/9/port/sdram.c
+++ b/sys/src/9/port/sdram.c
@@ -169,7 +169,7 @@
 {
 	SDev *sdev;
 
-	sdev = xalloc(sizeof(SDev));
+	sdev = malloc(sizeof(SDev));
 	if(sdev == nil)
 		return nil;