]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - ipc/ipcdev.git/blobdiff - packages/ti/sdo/ipc/nsremote/NameServerRemoteNotify.c
nsremote: Add additional check to handle assert disabled
[ipc/ipcdev.git] / packages / ti / sdo / ipc / nsremote / NameServerRemoteNotify.c
index 5abac2cfa0418e8a9fc429da74e01880b0677e60..f11ba53910b9a2df18ca45e86843f9c50d2437a3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2014, Texas Instruments Incorporated
+ * Copyright (c) 2012-2019, Texas Instruments Incorporated
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -83,6 +83,7 @@ Int NameServerRemoteNotify_Instance_init(NameServerRemoteNotify_Object *obj,
     Semaphore_Handle  semHandle;
     Swi_Params        swiParams;
     Swi_Handle        swiHandle;
+    SizeT          cacheLineSize;
 
     /* Assert that a NameServerRemoteNotify_Params has been supplied */
     Assert_isTrue(params != NULL, Ipc_A_nullArgument);
@@ -101,20 +102,21 @@ Int NameServerRemoteNotify_Instance_init(NameServerRemoteNotify_Object *obj,
     obj->localState = NameServerRemoteNotify_IDLE;
     obj->remoteState = NameServerRemoteNotify_IDLE;
 
-    /* assert that sharedAddr is cache aligned */
-    Assert_isTrue(SharedRegion_getCacheLineSize(obj->regionId) == 0 ||
-            ((UInt32)params->sharedAddr %
-            SharedRegion_getCacheLineSize(obj->regionId) == 0),
+    cacheLineSize = SharedRegion_getCacheLineSize(obj->regionId);
+    if (cacheLineSize !=  0) {
+        /* assert that sharedAddr is cache aligned */
+        Assert_isTrue((((UArg)params->sharedAddr) %
+            cacheLineSize == 0),
             Ipc_A_addrNotCacheAligned);
 
-    /* asset message structure size is cache aligned */
-    Assert_isTrue(SharedRegion_getCacheLineSize(obj->regionId) == 0 ||
-            (sizeof(NameServerRemoteNotify_Message) %
-            SharedRegion_getCacheLineSize(obj->regionId)) == 0,
+        /* asset message structure size is cache aligned */
+        Assert_isTrue((sizeof(NameServerRemoteNotify_Message) %
+            cacheLineSize) == 0,
             NameServerRemoteNotify_A_messageSize);
+    }
 
     obj->msg[0] = (NameServerRemoteNotify_Message *)(params->sharedAddr);
-    obj->msg[1] = (NameServerRemoteNotify_Message *)((UInt32)obj->msg[0] +
+    obj->msg[1] = (NameServerRemoteNotify_Message *)((UArg)obj->msg[0] +
                           sizeof(NameServerRemoteNotify_Message));
     obj->gate = params->gate;
     obj->remoteProcId = remoteProcId;
@@ -295,6 +297,9 @@ Void NameServerRemoteNotify_cbFxn(UInt16 procId, UInt16 lineId, UInt32 eventId,
             /* We should never get here but assert if we do */
             Assert_isTrue(swiHandle != NULL, Ipc_A_internal);
     }
+    if (swiHandle == NULL) {
+        return;
+    }
 
     Swi_post(swiHandle);
 }