shithub: riscv

Download patch

ref: f5ff6d6f34e2cab60722a8a2e8444436c969bfeb
parent: 56d9f57dc8afd8ef4c6d54a10c958446dd2d7fbe
author: cinap_lenrek <cinap_lenrek@gmx.de>
date: Fri Feb 22 07:23:01 EST 2013

sdiahci: prevent nil pointer dereference on spurious interrupt status

on some controllers, we get bogus interrupt indication
for non present drives. ack the irq but ignore.

--- a/sys/src/9/pc/sdiahci.c
+++ b/sys/src/9/pc/sdiahci.c
@@ -1201,7 +1201,7 @@
 		cause &= ~m;
 		d = c->rawdrive + i;
 		ilock(d);
-		if(d->port->isr && c->hba->pi & m)
+		if(d->port != nil && d->port->isr && c->hba->pi & m)
 			updatedrive(d);
 		c->hba->isr = m;
 		iunlock(d);
--