TCI6614: Improve error message during config
authorChris Ring <cring@ti.com>
Mon, 20 May 2013 20:00:02 +0000 (13:00 -0700)
committerChris Ring <cring@ti.com>
Tue, 21 May 2013 22:09:10 +0000 (15:09 -0700)
When this package is integrated into an unsupported environment,
it provides a better error message.

For example, before this change, when [errantly] integrating into
an OMAP5-based system, configuration would report:
    TypeError: Cannot read property "IPCGR0" from undefined

Now it reports:
    ti.ipc.family.tci6614.Interrupt : OMAP5430 unsupported

packages/ti/ipc/family/tci6614/Interrupt.xs

index 861bba7e5e3e5792ecd2d766d8cfd3ad38065802..069e37b3e016e27703fd1e168f388b4f9099f967 100644 (file)
@@ -63,6 +63,12 @@ function module$meta$init()
     }
 
     var settings = deviceSettings[Program.cpu.deviceName];
+    if (settings == undefined) {
+        this.$logError(Program.cpu.deviceName + " unsupported", this);
+
+        /* Early return so we don't dereference settings object below */
+        return;
+    }
 
     this.IPCGR0         = settings.IPCGR0;
     this.IPCAR0         = settings.IPCAR0;