Module Name:    src
Committed By:   jruoho
Date:           Tue Apr 27 08:15:07 UTC 2010

Modified Files:
        src/sys/dev/acpi: acpi_util.c

Log Message:
Be consistent with the returned exception codes. Check for NULL pointers.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/acpi/acpi_util.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/acpi/acpi_util.c
diff -u src/sys/dev/acpi/acpi_util.c:1.3 src/sys/dev/acpi/acpi_util.c:1.4
--- src/sys/dev/acpi/acpi_util.c:1.3	Sat Apr 24 06:57:10 2010
+++ src/sys/dev/acpi/acpi_util.c	Tue Apr 27 08:15:07 2010
@@ -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 <sys/cdefs.h>
-__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 <sys/param.h>
 
@@ -228,9 +228,12 @@
 	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_BUFFER buf;
 	ACPI_STATUS rv;
 
+	if (handle == NULL)
+		handle = ACPI_ROOT_OBJECT;
+
 	buf.Pointer = name;
 	buf.Length = sizeof(name);
 

Reply via email to