Ver código fonte

disp: msm: sde: free the allocated memory of the acl and sgl descriptor

Allocated memory for acl and sgl descriptors is not being freed.
This is causing memory leak over multiple cycles of TUI tests.
To avoid this, free The allocated memory of descriptors.

Change-Id: I9bad0563009317d2e814185a8513f363a3359f6b
Signed-off-by: Akash Gajjar <[email protected]>
Akash Gajjar 1 ano atrás
pai
commit
8881c37e4a
1 arquivos alterados com 7 adições e 8 exclusões
  1. 7 8
      msm/sde/sde_vm_trusted.c

+ 7 - 8
msm/sde/sde_vm_trusted.c

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022, 2024 Qualcomm Innovation Center, Inc. All rights reserved.
  * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
  */
 
@@ -291,7 +291,7 @@ static int _sde_vm_accept_mem(struct sde_vm *vm)
 		SDE_ERROR("failed to populate acl data, rc=%ld\n",
 			   PTR_ERR(acl_desc));
 		rc = PTR_ERR(acl_desc);
-		goto done;
+		return rc;
 	}
 
 	sgl_desc = gh_rm_mem_accept(sde_vm->base.io_mem_handle,
@@ -309,7 +309,7 @@ static int _sde_vm_accept_mem(struct sde_vm *vm)
 
 		/* ACCEPT didn't go through. So no need to call the RELEASE */
 		sde_vm->base.io_mem_handle = -1;
-		goto accept_fail;
+		goto acl_done;
 	}
 
 	rc = _sde_vm_validate_sgl(sde_vm->sgl_desc, sgl_desc);
@@ -317,16 +317,15 @@ static int _sde_vm_accept_mem(struct sde_vm *vm)
 		SDE_ERROR(
 			"failed in sgl validation for SDE_VM_MEM_LABEL label, rc = %d\n",
 			rc);
-		goto accept_fail;
+		goto sgl_done;
 	}
 
 	SDE_INFO("mem accept succeeded for SDE_VM_MEM_LABEL label\n");
 
-	return 0;
-
-accept_fail:
+sgl_done:
+	kvfree(sgl_desc);
+acl_done:
 	kfree(acl_desc);
-done:
 	return rc;
 }