summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2022-02-14 03:51:43 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2022-02-14 03:51:43 +0000
commit620a4d6be8c39008d2e2ab99e9684acca55f37b8 (patch)
treef4110c645616a90a367ebb3ecadc53d133a74cf2 /sys/dev/pci
parent492d59e10c6cf446d78efdf7eb89665d70d3247f (diff)
change a NULL pa_memex test after use to an earlier KASSERT
from Ted Bullock
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/drm/amd/amdgpu/amdgpu_kms.c5
-rw-r--r--sys/dev/pci/drm/radeon/radeon_kms.c5
2 files changed, 6 insertions, 4 deletions
diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu_kms.c b/sys/dev/pci/drm/amd/amdgpu/amdgpu_kms.c
index 720a0fd550d..897686b2b49 100644
--- a/sys/dev/pci/drm/amd/amdgpu/amdgpu_kms.c
+++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu_kms.c
@@ -1782,14 +1782,15 @@ amdgpu_attach(struct device *parent, struct device *self, void *aux)
bus_size_t start, end, pci_mem_end;
bus_addr_t base;
+ KASSERT(pa->pa_memex != NULL);
+
start = max(PCI_MEM_START, pa->pa_memex->ex_start);
if (PCI_MAPREG_MEM_TYPE(type) == PCI_MAPREG_MEM_TYPE_64BIT)
pci_mem_end = PCI_MEM64_END;
else
pci_mem_end = PCI_MEM_END;
end = min(pci_mem_end, pa->pa_memex->ex_end);
- if (pa->pa_memex == NULL ||
- extent_alloc_subregion(pa->pa_memex, start, end,
+ if (extent_alloc_subregion(pa->pa_memex, start, end,
adev->fb_aper_size, adev->fb_aper_size, 0, 0, 0, &base)) {
printf(": can't reserve framebuffer space\n");
return;
diff --git a/sys/dev/pci/drm/radeon/radeon_kms.c b/sys/dev/pci/drm/radeon/radeon_kms.c
index a2d53f752bc..bd1951cfb6a 100644
--- a/sys/dev/pci/drm/radeon/radeon_kms.c
+++ b/sys/dev/pci/drm/radeon/radeon_kms.c
@@ -556,10 +556,11 @@ radeondrm_attach_kms(struct device *parent, struct device *self, void *aux)
bus_size_t start, end;
bus_addr_t base;
+ KASSERT(pa->pa_memex != NULL);
+
start = max(PCI_MEM_START, pa->pa_memex->ex_start);
end = min(PCI_MEM_END, pa->pa_memex->ex_end);
- if (pa->pa_memex == NULL ||
- extent_alloc_subregion(pa->pa_memex, start, end,
+ if (extent_alloc_subregion(pa->pa_memex, start, end,
rdev->fb_aper_size, rdev->fb_aper_size, 0, 0, 0, &base)) {
printf(": can't reserve framebuffer space\n");
return;