All other call sites of qcom_scm_pas_metadata_release() for the DTB
context are guarded by a check on pas->dtb_pas_id, but the call inside
qcom_pas_load() was not. Fix this by moving the call to the guarded
block.

Reviewed-by: Konrad Dybcio <[email protected]>
Signed-off-by: Mukesh Ojha <[email protected]>
---
Changes in v3: 
lore.kernel.org/lkml/[email protected]/
 - Added R-b tag and split the changes into 2.

Changes in v2: 
https://lore.kernel.org/lkml/sxklpgc2rtr75maiu7lg4iukmaetvjyho7ytyyykmtdu2tov3k@gctoozxj7frl/
 - No change.

 drivers/remoteproc/qcom_q6v5_pas.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/remoteproc/qcom_q6v5_pas.c 
b/drivers/remoteproc/qcom_q6v5_pas.c
index fb22f699c571..b957bfc86cda 100644
--- a/drivers/remoteproc/qcom_q6v5_pas.c
+++ b/drivers/remoteproc/qcom_q6v5_pas.c
@@ -243,14 +243,15 @@ static int qcom_pas_load(struct rproc *rproc, const 
struct firmware *fw)
                ret = qcom_mdt_pas_load(pas->dtb_pas_ctx, pas->dtb_firmware,
                                        pas->dtb_firmware_name, (__force void 
*)pas->dtb_mem_region,
                                        &pas->dtb_mem_reloc);
-               if (ret)
+               if (ret) {
+                       qcom_scm_pas_metadata_release(pas->dtb_pas_ctx);
                        goto release_dtb_metadata;
+               }
        }
 
        return 0;
 
 release_dtb_metadata:
-       qcom_scm_pas_metadata_release(pas->dtb_pas_ctx);
        release_firmware(pas->dtb_firmware);
 
        return ret;
-- 
2.53.0


Reply via email to