diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 02a396d..55e9a8e 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c @@ -262,21 +262,29 @@ static int extract_package(struct acpi_battery *battery, { int i, *x; union acpi_object *element; - if (package->type != ACPI_TYPE_PACKAGE) + if (package->type != ACPI_TYPE_PACKAGE) { +printk (KERN_ERR PREFIX "package->type = %x\n", package->type); return -EFAULT; + } for (i = 0; i < num; ++i) { - if (package->package.count <= i) + if (package->package.count <= i) { +printk (KERN_ERR PREFIX "package.count = %d, i = %d\n", package->package.count, i); return -EFAULT; + } element = &package->package.elements[i]; if (offsets[i].mode) { if (element->type != ACPI_TYPE_STRING && - element->type != ACPI_TYPE_BUFFER) + element->type != ACPI_TYPE_BUFFER) { +printk (KERN_ERR PREFIX "element[%d]->type = %x, expected string\n", i, element->type); return -EFAULT; + } strncpy((u8 *)battery + offsets[i].offset, element->string.pointer, 32); } else { - if (element->type != ACPI_TYPE_INTEGER) + if (element->type != ACPI_TYPE_INTEGER) { +printk (KERN_ERR PREFIX "element[%d]->type = %x, expected integer\n", i, element->type); return -EFAULT; + } x = (int *)((u8 *)battery + offsets[i].offset); *x = element->integer.value; }