mfd: Check ACPI device companion before checking resources
authorLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Fri, 1 May 2015 09:41:10 +0000 (10:41 +0100)
committerLee Jones <lee.jones@linaro.org>
Mon, 22 Jun 2015 11:25:17 +0000 (12:25 +0100)
Current code in mfd-core calls into ACPI to check resources even
on a system that booted with a DT (on kernels with both DT and ACPI
support compiled in). This triggers ACPI exceptions since we may
end up calling the ACPI interpreter when it has not been initialized:

"ACPI Exception: AE_BAD_PARAMETER, Thread 2064154624 could not acquire
Mutex [0x1] (20150410/utmutex-285)"

This patch fixes the issues by adding a check for an ACPI companion
device before carrying out ACPI resources checks to avoid calling
the ACPI interpreter if the fwnode representing the device is an OF one.

Cc: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
drivers/mfd/mfd-core.c

index 1aed3b7b8d9be1e965904a0cd4f7923a2310de2e..14fd5cbcf0f2db27dbbea8378889addf4b2bb757 100644 (file)
@@ -207,9 +207,11 @@ static int mfd_add_device(struct device *parent, int id,
                }
 
                if (!cell->ignore_resource_conflicts) {
-                       ret = acpi_check_resource_conflict(&res[r]);
-                       if (ret)
-                               goto fail_alias;
+                       if (has_acpi_companion(&pdev->dev)) {
+                               ret = acpi_check_resource_conflict(&res[r]);
+                               if (ret)
+                                       goto fail_alias;
+                       }
                }
        }