msm: smd_pkt: add enforcement that array lengths match number of ports

Additional checks are added to enforce that ports are equal in number
to the size of their representative arrays, to provide sanity checks when
ports are added or removed.

Change-Id: I83e7d74b8c21df8e357a817b7e542006b9b675a8
Signed-off-by: Brent Hronik <bhronik@codeaurora.org>
diff --git a/arch/arm/mach-msm/smd_pkt.c b/arch/arm/mach-msm/smd_pkt.c
index 20a6165..83d6c15 100644
--- a/arch/arm/mach-msm/smd_pkt.c
+++ b/arch/arm/mach-msm/smd_pkt.c
@@ -1028,6 +1028,13 @@
 	int i;
 	int r;
 
+	if (ARRAY_SIZE(smd_ch_name) != NUM_SMD_PKT_PORTS ||
+			ARRAY_SIZE(smd_ch_edge) != NUM_SMD_PKT_PORTS ||
+			ARRAY_SIZE(smd_pkt_dev_name) != NUM_SMD_PKT_PORTS) {
+		pr_err("%s: mismatch in number of ports\n", __func__);
+		BUG();
+	}
+
 	r = alloc_chrdev_region(&smd_pkt_number,
 			       0,
 			       NUM_SMD_PKT_PORTS,