diff options
-rw-r--r-- | drivers/acpi/acpi_platform.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/drivers/acpi/acpi_platform.c b/drivers/acpi/acpi_platform.c index 32136b85196d..1bde12708f9e 100644 --- a/drivers/acpi/acpi_platform.c +++ b/drivers/acpi/acpi_platform.c | |||
@@ -61,25 +61,23 @@ int acpi_create_platform_device(struct acpi_device *adev, | |||
61 | 61 | ||
62 | INIT_LIST_HEAD(&resource_list); | 62 | INIT_LIST_HEAD(&resource_list); |
63 | count = acpi_dev_get_resources(adev, &resource_list, NULL, NULL); | 63 | count = acpi_dev_get_resources(adev, &resource_list, NULL, NULL); |
64 | if (count < 0) | 64 | if (count < 0) { |
65 | return 0; | 65 | return 0; |
66 | } else if (count > 0) { | ||
67 | resources = kmalloc(count * sizeof(struct resource), | ||
68 | GFP_KERNEL); | ||
69 | if (!resources) { | ||
70 | dev_err(&adev->dev, "No memory for resources\n"); | ||
71 | acpi_dev_free_resource_list(&resource_list); | ||
72 | return -ENOMEM; | ||
73 | } | ||
74 | count = 0; | ||
75 | list_for_each_entry(rentry, &resource_list, node) | ||
76 | resources[count++] = rentry->res; | ||
66 | 77 | ||
67 | if (!count) | ||
68 | goto create_dev; | ||
69 | |||
70 | resources = kmalloc(count * sizeof(struct resource), GFP_KERNEL); | ||
71 | if (!resources) { | ||
72 | dev_err(&adev->dev, "No memory for resources\n"); | ||
73 | acpi_dev_free_resource_list(&resource_list); | 78 | acpi_dev_free_resource_list(&resource_list); |
74 | return -ENOMEM; | ||
75 | } | 79 | } |
76 | count = 0; | ||
77 | list_for_each_entry(rentry, &resource_list, node) | ||
78 | resources[count++] = rentry->res; | ||
79 | |||
80 | acpi_dev_free_resource_list(&resource_list); | ||
81 | 80 | ||
82 | create_dev: | ||
83 | memset(&pdevinfo, 0, sizeof(pdevinfo)); | 81 | memset(&pdevinfo, 0, sizeof(pdevinfo)); |
84 | /* | 82 | /* |
85 | * If the ACPI node has a parent and that parent has a physical device | 83 | * If the ACPI node has a parent and that parent has a physical device |