]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - ipc/ipcdev.git/blobdiff - packages/ti/sdo/ipc/nsremote/NameServerRemoteNotify.c
Prevent %-by-0 in Assert_isTrue() expressions
[ipc/ipcdev.git] / packages / ti / sdo / ipc / nsremote / NameServerRemoteNotify.c
index 409325061dd7a006a6c042976dd41b1c563b1788..5abac2cfa0418e8a9fc429da74e01880b0677e60 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * Copyright (c) 2012-2014, Texas Instruments Incorporated
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -102,12 +102,14 @@ Int NameServerRemoteNotify_Instance_init(NameServerRemoteNotify_Object *obj,
     obj->remoteState = NameServerRemoteNotify_IDLE;
 
     /* assert that sharedAddr is cache aligned */
-    Assert_isTrue(((UInt32)params->sharedAddr %
+    Assert_isTrue(SharedRegion_getCacheLineSize(obj->regionId) == 0 ||
+            ((UInt32)params->sharedAddr %
             SharedRegion_getCacheLineSize(obj->regionId) == 0),
             Ipc_A_addrNotCacheAligned);
 
     /* asset message structure size is cache aligned */
-    Assert_isTrue((sizeof(NameServerRemoteNotify_Message) %
+    Assert_isTrue(SharedRegion_getCacheLineSize(obj->regionId) == 0 ||
+            (sizeof(NameServerRemoteNotify_Message) %
             SharedRegion_getCacheLineSize(obj->regionId)) == 0,
             NameServerRemoteNotify_A_messageSize);
 
@@ -268,7 +270,7 @@ Void NameServerRemoteNotify_cbFxn(UInt16 procId, UInt16 lineId, UInt32 eventId,
         UArg arg, UInt32 payload)
 {
     NameServerRemoteNotify_Object *obj;
-    Swi_Handle swiHandle;
+    Swi_Handle swiHandle = NULL;
 
     obj = (NameServerRemoteNotify_Object *)arg;
 
@@ -288,6 +290,10 @@ Void NameServerRemoteNotify_cbFxn(UInt16 procId, UInt16 lineId, UInt32 eventId,
             /* set object state (used by ROV) */
             obj->localState = NameServerRemoteNotify_RECEIVE_RESPONSE;
             break;
+
+        default:
+            /* We should never get here but assert if we do */
+            Assert_isTrue(swiHandle != NULL, Ipc_A_internal);
     }
 
     Swi_post(swiHandle);