From: jsg Date: Mon, 14 Feb 2022 03:51:42 +0000 (+0000) Subject: change a NULL pa_memex test after use to an earlier KASSERT X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=7ac1f639e03db09c01aaa60bf9fa6ef919310ce2;p=openbsd change a NULL pa_memex test after use to an earlier KASSERT from Ted Bullock --- 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;