ACPI/PCI: handle multiple _OSC

The pci_osc_control_set() function can be called for the ACPI object
that doesn't have _OSC method. In this case, acpi_get_osc_data() would
allocate a useless memory region. To avoid this, we need to check the
existence of _OSC before calling acpi_get_osc_data(). Here is a patch
to fix this problem in pci_osc_control_set.

Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>

authored by Kenji Kaneshige and committed by Jesse Barnes 34a65055 a5d1c879

+7 -1
+7 -1
drivers/pci/pci-acpi.c
··· 232 232 { 233 233 acpi_status status; 234 234 u32 ctrlset; 235 - struct acpi_osc_data *osc_data = acpi_get_osc_data(handle); 235 + acpi_handle tmp; 236 + struct acpi_osc_data *osc_data; 236 237 238 + status = acpi_get_handle(handle, "_OSC", &tmp); 239 + if (ACPI_FAILURE(status)) 240 + return status; 241 + 242 + osc_data = acpi_get_osc_data(handle); 237 243 if (!osc_data) { 238 244 printk(KERN_ERR "acpi osc data array is full\n"); 239 245 return AE_ERROR;