diff options
author | Mika Westerberg <mika.westerberg@linux.intel.com> | 2013-09-02 06:30:25 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-09-02 06:59:40 -0400 |
commit | af65cfe9aeae03e0682bebdf4db94582d75562dd (patch) | |
tree | 197c7560e4510c4712a8ae3dddc283705a88f8c9 /drivers/acpi | |
parent | 524f42fab787a9510be826ce3d736b56d454ac6d (diff) |
ACPI / LPSS: don't crash if a device has no MMIO resources
Intel LPSS devices that are enumerated from ACPI have both MMIO and IRQ
resources returned in their _CRS method. However, Apple Macbook Air with
Haswell has LPSS devices enumerated from PCI bus instead and _CRS method
returns only an interrupt number (but the device has _HID set that causes
the scan handler to match it).
The current ACPI / LPSS code sets pdata->dev_desc only when MMIO resource
is found for the device and in case of Macbook Air it is never found. That
leads to a NULL pointer dereference in register_device_clock().
Correct this by always setting the pdata->dev_desc.
Reported-and-tested-by: Imre Kaloz <kaloz@openwrt.org>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: 3.10+ <stable@vger.kernel.org> # 3.10+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/acpi_lpss.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c index 6a382188fa20..fb78bb9ad8f6 100644 --- a/drivers/acpi/acpi_lpss.c +++ b/drivers/acpi/acpi_lpss.c | |||
@@ -257,12 +257,13 @@ static int acpi_lpss_create_device(struct acpi_device *adev, | |||
257 | pdata->mmio_size = resource_size(&rentry->res); | 257 | pdata->mmio_size = resource_size(&rentry->res); |
258 | pdata->mmio_base = ioremap(rentry->res.start, | 258 | pdata->mmio_base = ioremap(rentry->res.start, |
259 | pdata->mmio_size); | 259 | pdata->mmio_size); |
260 | pdata->dev_desc = dev_desc; | ||
261 | break; | 260 | break; |
262 | } | 261 | } |
263 | 262 | ||
264 | acpi_dev_free_resource_list(&resource_list); | 263 | acpi_dev_free_resource_list(&resource_list); |
265 | 264 | ||
265 | pdata->dev_desc = dev_desc; | ||
266 | |||
266 | if (dev_desc->clk_required) { | 267 | if (dev_desc->clk_required) { |
267 | ret = register_device_clock(adev, pdata); | 268 | ret = register_device_clock(adev, pdata); |
268 | if (ret) { | 269 | if (ret) { |