Skip to contentSkip to conversation

firmware: tee_bnxt: Fix multiple call to tee_client_close_context

PATCH Applied Vikas Gupta 3 participants 4 messages Jan 6, 2020

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 firmware: tee_bnxt: Fix multiple call to tee_client_close_context

Fix calling multiple tee_client_close_context in case of shm allocation fails.

Fixes 246880958ac9 (“firmware: broadcom: add OP-TEE based BNXT f/w manager”)
---
 drivers/firmware/broadcom/tee_bnxt_fw.c | 1 -
 1 file changed, 1 deletion(-)
drivers/firmware/broadcom/tee_bnxt_fw.c +0 -1
index 5b7ef89..ed10da5 100644
@@ -215,7 +215,6 @@ static int tee_bnxt_fw_probe(struct device *dev)
 	fw_shm_pool = tee_shm_alloc(pvt_data.ctx, MAX_SHM_MEM_SZ,
 				    TEE_SHM_MAPPED | TEE_SHM_DMA_BUF);
 	if (IS_ERR(fw_shm_pool)) {
-		tee_client_close_context(pvt_data.ctx);
 		dev_err(pvt_data.dev, "tee_shm_alloc failed\n");
 		err = PTR_ERR(fw_shm_pool);
 		goto out_sess;
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 firmware: tee_bnxt: Reduce shm mem size to 4K

Reduce shm memory size as maximum size supported by optee_shm_register API is 4K.

Fixes 246880958ac9 (“firmware: broadcom: add OP-TEE based BNXT f/w manager”)
---
 drivers/firmware/broadcom/tee_bnxt_fw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/broadcom/tee_bnxt_fw.c +1 -1
index 5b7ef89..8f0c61c6 100644
@@ -12,7 +12,7 @@
 
 #include <linux/firmware/broadcom/tee_bnxt_fw.h>
 
-#define MAX_SHM_MEM_SZ	SZ_4M
+#define MAX_SHM_MEM_SZ	SZ_4K
 
 #define MAX_TEE_PARAM_ARRY_MEMB		4
 
Signature · 1 line
2.7.4
#2 lore raw

Re: [PATCH v1] firmware: tee_bnxt: Reduce shm mem size to 4K

+ Jens

Hi Vikas,

Quoted 4 lines · Vikas Gupta

Reduce shm memory size as maximum size supported by optee_shm_register API is 4K.

There isn't any 4K size limitation with optee_shm_register() but rather its an issue in upstream that is fixed via this patch [1]. Give it a try and let me know if it works for you.

[1] https://lkml.org/lkml/2019/12/30/189

-Sumit

Quoted 22 lines
Fixes 246880958ac9 (“firmware: broadcom: add OP-TEE based BNXT f/w manager”)
---
 drivers/firmware/broadcom/tee_bnxt_fw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/broadcom/tee_bnxt_fw.c +1 -2
index 5b7ef89..8f0c61c6 100644
@@ -12,7 +12,7 @@
 
 #include <linux/firmware/broadcom/tee_bnxt_fw.h>
 
-#define MAX_SHM_MEM_SZ SZ_4M
+#define MAX_SHM_MEM_SZ SZ_4K
 
 #define MAX_TEE_PARAM_ARRY_MEMB                4
 
--

2.7.4