mirror of
https://gitlab.freedesktop.org/mesa/drm.git
synced 2025-12-20 15:10:10 +01:00
drm: ioremap balanced with iounmap for drivers/char/drm
ioremap must be balanced by an iounmap and failing to do so can result in a memory leak. Tested (compilation only) to make sure the files are compiling without any warning/error due to new changes Signed-off-by: Amol Lad <amol@verismonetworks.com> Signed-off-by: Dave Airlie <airlied@linux.ie>
This commit is contained in:
parent
b3c88d31e1
commit
cc22cd8bde
1 changed files with 4 additions and 0 deletions
|
|
@ -279,6 +279,8 @@ static int drm_addmap_core(drm_device_t * dev, unsigned int offset,
|
|||
|
||||
list = drm_alloc(sizeof(*list), DRM_MEM_MAPS);
|
||||
if (!list) {
|
||||
if (map->type == _DRM_REGISTERS)
|
||||
drm_ioremap(map->handle, map->size, dev);
|
||||
drm_free(map, sizeof(*map), DRM_MEM_MAPS);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
@ -295,6 +297,8 @@ static int drm_addmap_core(drm_device_t * dev, unsigned int offset,
|
|||
ret = drm_map_handle(dev, &list->hash, user_token, 0);
|
||||
|
||||
if (ret) {
|
||||
if (map->type == _DRM_REGISTERS)
|
||||
drm_ioremap(map->handle, map->size, dev);
|
||||
drm_free(map, sizeof(*map), DRM_MEM_MAPS);
|
||||
drm_free(list, sizeof(*list), DRM_MEM_MAPS);
|
||||
mutex_unlock(&dev->struct_mutex);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue