acpi: fix use of unitialized mutex

This commit is contained in:
Matheus
2024-09-21 18:34:36 -03:00
parent 78e5b111cf
commit 49dbac8e55
2 changed files with 5 additions and 3 deletions
+1
View File
@@ -112,5 +112,6 @@ static devops_t acpiops = {
void acpi_initdevice(void) {
__assert(devfs_register(&acpiops, "acpi", V_TYPE_CHDEV, DEV_MAJOR_ACPI, 0, 0600, NULL) == 0);
__assert(ringbuffer_init(&ringbuffer, 64) == 0);
MUTEX_INIT(&mutex);
POLL_INITHEADER(&pollheader);
}
+4 -3
View File
@@ -256,14 +256,15 @@ static int read(int minor, iovec_iterator_t *iovec_iterator, size_t size, uintma
}
error = poll_dowait(&desc, effectivetimeout);
poll_leave(&desc);
poll_destroydesc(&desc);
if (error == 0 && (desc.event == NULL || (desc.event && desc.event->revents == 0))) {
// timed out!
break;
}
poll_leave(&desc);
poll_destroydesc(&desc);
if (error)
goto leave;
}