mirror of
https://gitlab.freedesktop.org/mesa/drm.git
synced 2026-05-06 04:48:22 +02:00
Correct another LOR issue with resource allocation. This leaves the
drm_get_resource_* resource allocation a little racy, but they're
getting called at either X Server startup or driver load, so it's
serialized anyway.
This commit is contained in:
parent
a10d8178e3
commit
c7af46cf7d
2 changed files with 8 additions and 1 deletions
|
|
@ -61,12 +61,17 @@ static int drm_alloc_resource(drm_device_t *dev, int resource)
|
|||
DRM_ERROR("Resource %d too large\n", resource);
|
||||
return 1;
|
||||
}
|
||||
if (dev->pcir[resource] != NULL)
|
||||
|
||||
DRM_UNLOCK();
|
||||
if (dev->pcir[resource] != NULL) {
|
||||
DRM_LOCK();
|
||||
return 0;
|
||||
}
|
||||
|
||||
dev->pcirid[resource] = PCIR_BAR(resource);
|
||||
dev->pcir[resource] = bus_alloc_resource_any(dev->device,
|
||||
SYS_RES_MEMORY, &dev->pcirid[resource], RF_SHAREABLE);
|
||||
DRM_LOCK();
|
||||
|
||||
if (dev->pcir[resource] == NULL) {
|
||||
DRM_ERROR("Couldn't find resource 0x%x\n", resource);
|
||||
|
|
|
|||
|
|
@ -508,7 +508,9 @@ static int drm_load(drm_device_t *dev)
|
|||
TAILQ_INIT(&dev->files);
|
||||
|
||||
if (dev->driver.load != NULL) {
|
||||
DRM_LOCK();
|
||||
retcode = dev->driver.load(dev, dev->id_entry->driver_private);
|
||||
DRM_UNLOCK();
|
||||
if (retcode != 0)
|
||||
goto error;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue