diff options
author | Eric Anholt <anholt@freebsd.org> | 2005-11-08 21:36:54 +0000 |
---|---|---|
committer | Eric Anholt <anholt@freebsd.org> | 2005-11-08 21:36:54 +0000 |
commit | c7af46cf7d464ff89c64ab864fcd2af51d462812 (patch) | |
tree | 8914e1dff006a008700769a7eddad328ace85d39 /bsd-core | |
parent | a10d8178e32528e0fd8a7afa24e71a35b1c0582d (diff) |
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.
Diffstat (limited to 'bsd-core')
-rw-r--r-- | bsd-core/drm_bufs.c | 7 | ||||
-rw-r--r-- | bsd-core/drm_drv.c | 2 |
2 files changed, 8 insertions, 1 deletions
diff --git a/bsd-core/drm_bufs.c b/bsd-core/drm_bufs.c index 5edc6feb..33da79e7 100644 --- a/bsd-core/drm_bufs.c +++ b/bsd-core/drm_bufs.c @@ -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); diff --git a/bsd-core/drm_drv.c b/bsd-core/drm_drv.c index 951f7462..d32534cb 100644 --- a/bsd-core/drm_drv.c +++ b/bsd-core/drm_drv.c @@ -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; } |