Commit af65cfe9 authored by Mika Westerberg's avatar Mika Westerberg Committed by Rafael J. Wysocki

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: default avatarImre Kaloz <kaloz@openwrt.org>
Signed-off-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
Cc: 3.10+ <stable@vger.kernel.org> # 3.10+
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 524f42fa
...@@ -257,12 +257,13 @@ static int acpi_lpss_create_device(struct acpi_device *adev, ...@@ -257,12 +257,13 @@ static int acpi_lpss_create_device(struct acpi_device *adev,
pdata->mmio_size = resource_size(&rentry->res); pdata->mmio_size = resource_size(&rentry->res);
pdata->mmio_base = ioremap(rentry->res.start, pdata->mmio_base = ioremap(rentry->res.start,
pdata->mmio_size); pdata->mmio_size);
pdata->dev_desc = dev_desc;
break; break;
} }
acpi_dev_free_resource_list(&resource_list); acpi_dev_free_resource_list(&resource_list);
pdata->dev_desc = dev_desc;
if (dev_desc->clk_required) { if (dev_desc->clk_required) {
ret = register_device_clock(adev, pdata); ret = register_device_clock(adev, pdata);
if (ret) { if (ret) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment