| .. | .. |
|---|
| 227 | 227 | |
|---|
| 228 | 228 | if (!found) |
|---|
| 229 | 229 | return false; |
|---|
| 230 | + pci_dev_put(pdev); |
|---|
| 230 | 231 | |
|---|
| 231 | 232 | rdev->bios = kmalloc(size, GFP_KERNEL); |
|---|
| 232 | 233 | if (!rdev->bios) { |
|---|
| .. | .. |
|---|
| 612 | 613 | acpi_size tbl_size; |
|---|
| 613 | 614 | UEFI_ACPI_VFCT *vfct; |
|---|
| 614 | 615 | unsigned offset; |
|---|
| 616 | + bool r = false; |
|---|
| 615 | 617 | |
|---|
| 616 | 618 | if (!ACPI_SUCCESS(acpi_get_table("VFCT", 1, &hdr))) |
|---|
| 617 | 619 | return false; |
|---|
| 618 | 620 | tbl_size = hdr->length; |
|---|
| 619 | 621 | if (tbl_size < sizeof(UEFI_ACPI_VFCT)) { |
|---|
| 620 | 622 | DRM_ERROR("ACPI VFCT table present but broken (too short #1)\n"); |
|---|
| 621 | | - return false; |
|---|
| 623 | + goto out; |
|---|
| 622 | 624 | } |
|---|
| 623 | 625 | |
|---|
| 624 | 626 | vfct = (UEFI_ACPI_VFCT *)hdr; |
|---|
| .. | .. |
|---|
| 631 | 633 | offset += sizeof(VFCT_IMAGE_HEADER); |
|---|
| 632 | 634 | if (offset > tbl_size) { |
|---|
| 633 | 635 | DRM_ERROR("ACPI VFCT image header truncated\n"); |
|---|
| 634 | | - return false; |
|---|
| 636 | + goto out; |
|---|
| 635 | 637 | } |
|---|
| 636 | 638 | |
|---|
| 637 | 639 | offset += vhdr->ImageLength; |
|---|
| 638 | 640 | if (offset > tbl_size) { |
|---|
| 639 | 641 | DRM_ERROR("ACPI VFCT image truncated\n"); |
|---|
| 640 | | - return false; |
|---|
| 642 | + goto out; |
|---|
| 641 | 643 | } |
|---|
| 642 | 644 | |
|---|
| 643 | 645 | if (vhdr->ImageLength && |
|---|
| .. | .. |
|---|
| 649 | 651 | rdev->bios = kmemdup(&vbios->VbiosContent, |
|---|
| 650 | 652 | vhdr->ImageLength, |
|---|
| 651 | 653 | GFP_KERNEL); |
|---|
| 654 | + if (rdev->bios) |
|---|
| 655 | + r = true; |
|---|
| 652 | 656 | |
|---|
| 653 | | - if (!rdev->bios) |
|---|
| 654 | | - return false; |
|---|
| 655 | | - return true; |
|---|
| 657 | + goto out; |
|---|
| 656 | 658 | } |
|---|
| 657 | 659 | } |
|---|
| 658 | 660 | |
|---|
| 659 | 661 | DRM_ERROR("ACPI VFCT table present but broken (too short #2)\n"); |
|---|
| 660 | | - return false; |
|---|
| 662 | + |
|---|
| 663 | +out: |
|---|
| 664 | + acpi_put_table(hdr); |
|---|
| 665 | + return r; |
|---|
| 661 | 666 | } |
|---|
| 662 | 667 | #else |
|---|
| 663 | 668 | static inline bool radeon_acpi_vfct_bios(struct radeon_device *rdev) |
|---|