Skip to content

Commit

Permalink
drm: ioremap balanced with iounmap for drivers/char/drm
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Amol Lad authored and Dave Airlie committed Oct 25, 2006
1 parent 24f73c9 commit 85abb3f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/char/drm/drm_bufs.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,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_ioremapfree(map->handle, map->size, dev);
drm_free(map, sizeof(*map), DRM_MEM_MAPS);
return -EINVAL;
}
Expand All @@ -252,6 +254,8 @@ static int drm_addmap_core(drm_device_t * dev, unsigned int offset,
map->offset;
ret = drm_map_handle(dev, &list->hash, user_token, 0);
if (ret) {
if (map->type == _DRM_REGISTERS)
drm_ioremapfree(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);
Expand Down

0 comments on commit 85abb3f

Please sign in to comment.