hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/gpu/drm/radeon/radeon_bios.c
....@@ -227,6 +227,7 @@
227227
228228 if (!found)
229229 return false;
230
+ pci_dev_put(pdev);
230231
231232 rdev->bios = kmalloc(size, GFP_KERNEL);
232233 if (!rdev->bios) {
....@@ -612,13 +613,14 @@
612613 acpi_size tbl_size;
613614 UEFI_ACPI_VFCT *vfct;
614615 unsigned offset;
616
+ bool r = false;
615617
616618 if (!ACPI_SUCCESS(acpi_get_table("VFCT", 1, &hdr)))
617619 return false;
618620 tbl_size = hdr->length;
619621 if (tbl_size < sizeof(UEFI_ACPI_VFCT)) {
620622 DRM_ERROR("ACPI VFCT table present but broken (too short #1)\n");
621
- return false;
623
+ goto out;
622624 }
623625
624626 vfct = (UEFI_ACPI_VFCT *)hdr;
....@@ -631,13 +633,13 @@
631633 offset += sizeof(VFCT_IMAGE_HEADER);
632634 if (offset > tbl_size) {
633635 DRM_ERROR("ACPI VFCT image header truncated\n");
634
- return false;
636
+ goto out;
635637 }
636638
637639 offset += vhdr->ImageLength;
638640 if (offset > tbl_size) {
639641 DRM_ERROR("ACPI VFCT image truncated\n");
640
- return false;
642
+ goto out;
641643 }
642644
643645 if (vhdr->ImageLength &&
....@@ -649,15 +651,18 @@
649651 rdev->bios = kmemdup(&vbios->VbiosContent,
650652 vhdr->ImageLength,
651653 GFP_KERNEL);
654
+ if (rdev->bios)
655
+ r = true;
652656
653
- if (!rdev->bios)
654
- return false;
655
- return true;
657
+ goto out;
656658 }
657659 }
658660
659661 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;
661666 }
662667 #else
663668 static inline bool radeon_acpi_vfct_bios(struct radeon_device *rdev)