]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - ivimm/ipumm.git/commitdiff
Handling error in ivahd_init
authorBuddy Liong <a0270631@ti.com>
Sun, 28 Feb 2016 00:40:06 +0000 (18:40 -0600)
committerBuddy Liong <a0270631@ti.com>
Mon, 2 Oct 2017 15:19:52 +0000 (10:19 -0500)
In ivahd_init, when RMAN_init() or RMAN_register() fails, there is
no proper cleanup.
Adding proper cleanup when those functions are failing.

Change-Id: I2a644578cc9721e17129cb243baabc67923ee575
Signed-off-by: Buddy Liong <a0270631@ti.com>
src/ti/framework/dce/ivahd.c

index 352829b03964efa630b3bede33b7100748c97c59..3fa87f25310a48a117fb5ec0592bc9fbcb5f4a58 100644 (file)
@@ -472,13 +472,17 @@ void ivahd_init(uint32_t chipset_id)
 
     ret = RMAN_init();
     if( ret != IRES_OK ) {
+        ERROR("RMAN_init is failing ret %d", ret);
+        CERuntime_exit();
         goto end;
     }
 
     /* Register HDVICP with RMAN if not already registered */
     ret = RMAN_register(&IRESMAN_HDVICP, &rman_params);
     if((ret != IRES_OK) && (ret != IRES_EEXISTS)) {
-        DEBUG("could not register IRESMAN_HDVICP: %d", ret);
+        ERROR("could not register IRESMAN_HDVICP: %d", ret);
+        RMAN_exit();
+        CERuntime_exit();
         goto end;
     }
 
@@ -489,7 +493,13 @@ void ivahd_init(uint32_t chipset_id)
      */
     ret = RMAN_register(&IRESMAN_TILEDMEMORY, &rman_params);
     if((ret != IRES_OK) && (ret != IRES_EEXISTS)) {
-        DEBUG("could not register IRESMAN_TILEDMEMORY: %d", ret);
+        ERROR("could not register IRESMAN_TILEDMEMORY: %d", ret);
+        ret = RMAN_unregister(&IRESMAN_HDVICP);
+        if( ret != IRES_OK ) {
+            ERROR("RMAN_unregister on IRESMAN_HDVICP fail with ret %d", ret);
+        }
+        RMAN_exit();
+        CERuntime_exit();
         goto end;
     }