diff --git a/sys/dev/acpi/acpi_util.c b/sys/dev/acpi/acpi_util.c index 8a41debee13f..a9b2be2c43e2 100644 --- a/sys/dev/acpi/acpi_util.c +++ b/sys/dev/acpi/acpi_util.c @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_util.c,v 1.3 2010/04/24 06:57:10 jruoho Exp $ */ +/* $NetBSD: acpi_util.c,v 1.4 2010/04/27 08:15:07 jruoho Exp $ */ /*- * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc. @@ -65,7 +65,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: acpi_util.c,v 1.3 2010/04/24 06:57:10 jruoho Exp $"); +__KERNEL_RCSID(0, "$NetBSD: acpi_util.c,v 1.4 2010/04/27 08:15:07 jruoho Exp $"); #include @@ -228,9 +228,12 @@ acpi_foreach_package_object(ACPI_OBJECT *pkg, ACPI_STATUS rv = AE_OK; uint32_t i; - if (pkg == NULL || pkg->Type != ACPI_TYPE_PACKAGE) + if (pkg == NULL) return AE_BAD_PARAMETER; + if (pkg->Type != ACPI_TYPE_PACKAGE) + return AE_TYPE; + for (i = 0; i < pkg->Package.Count; i++) { rv = (*func)(&pkg->Package.Elements[i], arg); @@ -295,6 +298,9 @@ acpi_name(ACPI_HANDLE handle) ACPI_BUFFER buf; ACPI_STATUS rv; + if (handle == NULL) + handle = ACPI_ROOT_OBJECT; + buf.Pointer = name; buf.Length = sizeof(name);