Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 85abb3f9 authored by Amol Lad's avatar Amol Lad Committed by Dave Airlie
Browse files

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: default avatarAmol Lad <amol@verismonetworks.com>
Signed-off-by: default avatarDave Airlie <airlied@linux.ie>
parent 24f73c92
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -237,6 +237,8 @@ static int drm_addmap_core(drm_device_t * dev, unsigned int offset,


	list = drm_alloc(sizeof(*list), DRM_MEM_MAPS);
	list = drm_alloc(sizeof(*list), DRM_MEM_MAPS);
	if (!list) {
	if (!list) {
		if (map->type == _DRM_REGISTERS)
			drm_ioremapfree(map->handle, map->size, dev);
		drm_free(map, sizeof(*map), DRM_MEM_MAPS);
		drm_free(map, sizeof(*map), DRM_MEM_MAPS);
		return -EINVAL;
		return -EINVAL;
	}
	}
@@ -252,6 +254,8 @@ static int drm_addmap_core(drm_device_t * dev, unsigned int offset,
		map->offset;
		map->offset;
	ret = drm_map_handle(dev, &list->hash, user_token, 0);
	ret = drm_map_handle(dev, &list->hash, user_token, 0);
	if (ret) {
	if (ret) {
		if (map->type == _DRM_REGISTERS)
			drm_ioremapfree(map->handle, map->size, dev);
		drm_free(map, sizeof(*map), DRM_MEM_MAPS);
		drm_free(map, sizeof(*map), DRM_MEM_MAPS);
		drm_free(list, sizeof(*list), DRM_MEM_MAPS);
		drm_free(list, sizeof(*list), DRM_MEM_MAPS);
		mutex_unlock(&dev->struct_mutex);
		mutex_unlock(&dev->struct_mutex);