diff options
Diffstat (limited to 'drivers/acpi/pci_link.c')
-rw-r--r-- | drivers/acpi/pci_link.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index d53bd9878ca2..481e633bbf41 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c | |||
@@ -103,7 +103,7 @@ DEFINE_MUTEX(acpi_link_lock); | |||
103 | static acpi_status | 103 | static acpi_status |
104 | acpi_pci_link_check_possible(struct acpi_resource *resource, void *context) | 104 | acpi_pci_link_check_possible(struct acpi_resource *resource, void *context) |
105 | { | 105 | { |
106 | struct acpi_pci_link *link = (struct acpi_pci_link *)context; | 106 | struct acpi_pci_link *link = context; |
107 | u32 i = 0; | 107 | u32 i = 0; |
108 | 108 | ||
109 | 109 | ||
@@ -307,11 +307,10 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) | |||
307 | if (!link || !irq) | 307 | if (!link || !irq) |
308 | return -EINVAL; | 308 | return -EINVAL; |
309 | 309 | ||
310 | resource = kmalloc(sizeof(*resource) + 1, irqs_disabled() ? GFP_ATOMIC: GFP_KERNEL); | 310 | resource = kzalloc(sizeof(*resource) + 1, irqs_disabled() ? GFP_ATOMIC: GFP_KERNEL); |
311 | if (!resource) | 311 | if (!resource) |
312 | return -ENOMEM; | 312 | return -ENOMEM; |
313 | 313 | ||
314 | memset(resource, 0, sizeof(*resource) + 1); | ||
315 | buffer.length = sizeof(*resource) + 1; | 314 | buffer.length = sizeof(*resource) + 1; |
316 | buffer.pointer = resource; | 315 | buffer.pointer = resource; |
317 | 316 | ||
@@ -613,7 +612,7 @@ acpi_pci_link_allocate_irq(acpi_handle handle, | |||
613 | return -1; | 612 | return -1; |
614 | } | 613 | } |
615 | 614 | ||
616 | link = (struct acpi_pci_link *)acpi_driver_data(device); | 615 | link = acpi_driver_data(device); |
617 | if (!link) { | 616 | if (!link) { |
618 | printk(KERN_ERR PREFIX "Invalid link context\n"); | 617 | printk(KERN_ERR PREFIX "Invalid link context\n"); |
619 | return -1; | 618 | return -1; |
@@ -668,7 +667,7 @@ int acpi_pci_link_free_irq(acpi_handle handle) | |||
668 | return -1; | 667 | return -1; |
669 | } | 668 | } |
670 | 669 | ||
671 | link = (struct acpi_pci_link *)acpi_driver_data(device); | 670 | link = acpi_driver_data(device); |
672 | if (!link) { | 671 | if (!link) { |
673 | printk(KERN_ERR PREFIX "Invalid link context\n"); | 672 | printk(KERN_ERR PREFIX "Invalid link context\n"); |
674 | return -1; | 673 | return -1; |
@@ -718,10 +717,9 @@ static int acpi_pci_link_add(struct acpi_device *device) | |||
718 | if (!device) | 717 | if (!device) |
719 | return -EINVAL; | 718 | return -EINVAL; |
720 | 719 | ||
721 | link = kmalloc(sizeof(struct acpi_pci_link), GFP_KERNEL); | 720 | link = kzalloc(sizeof(struct acpi_pci_link), GFP_KERNEL); |
722 | if (!link) | 721 | if (!link) |
723 | return -ENOMEM; | 722 | return -ENOMEM; |
724 | memset(link, 0, sizeof(struct acpi_pci_link)); | ||
725 | 723 | ||
726 | link->device = device; | 724 | link->device = device; |
727 | strcpy(acpi_device_name(device), ACPI_PCI_LINK_DEVICE_NAME); | 725 | strcpy(acpi_device_name(device), ACPI_PCI_LINK_DEVICE_NAME); |
@@ -808,7 +806,7 @@ static int acpi_pci_link_remove(struct acpi_device *device, int type) | |||
808 | if (!device || !acpi_driver_data(device)) | 806 | if (!device || !acpi_driver_data(device)) |
809 | return -EINVAL; | 807 | return -EINVAL; |
810 | 808 | ||
811 | link = (struct acpi_pci_link *)acpi_driver_data(device); | 809 | link = acpi_driver_data(device); |
812 | 810 | ||
813 | mutex_lock(&acpi_link_lock); | 811 | mutex_lock(&acpi_link_lock); |
814 | list_del(&link->node); | 812 | list_del(&link->node); |