[qca-nss-drv] Treat warnings as error

Change-Id: Id69bd801298acf5b656996cb45f4ce570090b8f8
Signed-off-by: Arunkumar T <athand@codeaurora.org>
diff --git a/Makefile b/Makefile
index 60066d4..04387b3 100644
--- a/Makefile
+++ b/Makefile
@@ -78,6 +78,7 @@
 ccflags-y += -I$(obj)/nss_hal/include -I$(obj)/nss_data_plane/include -I$(obj)/exports -DNSS_DEBUG_LEVEL=0 -DNSS_PKT_STATS_ENABLED=1
 
 ccflags-y += -DNSS_PM_DEBUG_LEVEL=0 -DNSS_SKB_RECYCLE_SUPPORT=1
+ccflags-y += -Werror
 
 ifneq ($(findstring 3.4, $(KERNELVERSION)),)
 NSS_CCFLAGS = -DNSS_DT_SUPPORT=0 -DNSS_FW_DBG_SUPPORT=1 -DNSS_PM_SUPPORT=1 -DNSS_EMPTY_BUFFER_SIZE=1984
diff --git a/nss_bridge.c b/nss_bridge.c
index c1ed773..e1ddff9 100644
--- a/nss_bridge.c
+++ b/nss_bridge.c
@@ -36,7 +36,6 @@
 static void nss_bridge_handler(struct nss_ctx_instance *nss_ctx, struct nss_cmn_msg *ncm, void *app_data)
 {
 	struct nss_bridge_msg *nbm = (struct nss_bridge_msg *)ncm;
-	void *ctx;
 	nss_bridge_msg_callback_t cb;
 
 	BUG_ON(!nss_is_dynamic_interface(ncm->interface));
diff --git a/nss_ipv4_log.c b/nss_ipv4_log.c
index 3321069..0f5d067 100644
--- a/nss_ipv4_log.c
+++ b/nss_ipv4_log.c
@@ -25,7 +25,7 @@
  * nss_ipv4_log_message_types_str
  *	IPv4 bridge/route rule message strings
  */
-static int8_t *nss_ipv4_log_message_types_str[NSS_IPV4_MAX_MSG_TYPES] = {
+static int8_t *nss_ipv4_log_message_types_str[NSS_IPV4_MAX_MSG_TYPES] __maybe_unused = {
 	"IPv4 create rule message",
 	"IPv4 destroy rule message",
 	"Deprecated: NSS_IPV4_RX_ESTABLISH_RULE_MSG",
@@ -40,7 +40,7 @@
  * nss_ipv4_log_error_response_types_str
  *	Strings for error types for ipv4 messages
  */
-static int8_t *nss_ipv4_log_error_response_types_str[NSS_IPV4_LAST] = {
+static int8_t *nss_ipv4_log_error_response_types_str[NSS_IPV4_LAST] __maybe_unused = {
 	"No error",
 	"Unknown error",
 	"Invalid interface number",
@@ -63,7 +63,7 @@
  */
 static void nss_ipv4_log_rule_create_msg(struct nss_ipv4_msg *nim)
 {
-	struct nss_ipv4_rule_create_msg *nircm = &nim->msg.rule_create;
+	struct nss_ipv4_rule_create_msg *nircm __maybe_unused = &nim->msg.rule_create;
 	nss_trace("%p: IPv4 create rule message \n"
 		"Protocol: %d\n"
 		"from_mtu: %u\n"
@@ -124,7 +124,7 @@
  */
 static void nss_ipv4_log_destroy_rule_msg(struct nss_ipv4_msg *nim)
 {
-	struct nss_ipv4_rule_destroy_msg *nirdm = &nim->msg.rule_destroy;
+	struct nss_ipv4_rule_destroy_msg *nirdm __maybe_unused = &nim->msg.rule_destroy;
 	nss_trace("%p: IPv4 destroy rule message: \n"
 		"flow_ip: %pI4h:%d\n"
 		"return_ip: %pI4h:%d\n"
@@ -176,7 +176,7 @@
  */
 static void nss_ipv4_log_conn_cfg_msg(struct nss_ipv4_msg *nim)
 {
-	struct nss_ipv4_rule_conn_cfg_msg *nirccm = &nim->msg.rule_conn_cfg;
+	struct nss_ipv4_rule_conn_cfg_msg *nirccm __maybe_unused = &nim->msg.rule_conn_cfg;
 	nss_trace("%p: IPv4 number of connections supported rule message: \n"
 		"num_conn: %d\n",
 		nim,
@@ -349,4 +349,4 @@
 
 verbose:
 	nss_ipv4_log_verbose(nim);
-}
\ No newline at end of file
+}
diff --git a/nss_ipv6_log.c b/nss_ipv6_log.c
index 48703d3..02e6d59 100644
--- a/nss_ipv6_log.c
+++ b/nss_ipv6_log.c
@@ -36,7 +36,7 @@
  * nss_ipv6_log_message_types_str
  *	IPv6 bridge/route rule messages strings
  */
-static int8_t *nss_ipv6_log_message_types_str[NSS_IPV6_MAX_MSG_TYPES] = {
+static int8_t *nss_ipv6_log_message_types_str[NSS_IPV6_MAX_MSG_TYPES] __maybe_unused = {
 	"IPv6 create rule message",
 	"IPv6 destroy rule message",
 	"Deprecated: NSS_IPV4_RX_ESTABLISH_RULE_MSG",
@@ -51,7 +51,7 @@
  * nss_ipv6_log_error_response_types_str
  *	Strings for error types for ipv6 messages
  */
-static int8_t *nss_ipv6_log_error_response_types_str[] = {
+static int8_t *nss_ipv6_log_error_response_types_str[] __maybe_unused = {
 	"No error",
 	"Unknown error",
 	"Invalid interface number",
@@ -201,7 +201,7 @@
  */
 static void nss_ipv6_log_conn_cfg_msg(struct nss_ipv6_msg *nim)
 {
-	struct nss_ipv6_rule_conn_cfg_msg *nirccm = &nim->msg.rule_conn_cfg;
+	struct nss_ipv6_rule_conn_cfg_msg *nirccm __maybe_unused = &nim->msg.rule_conn_cfg;
 	nss_trace("%p: IPv6 number of connections supported rule message: \n"
 		"num_conn: %d\n",
 		nim,
diff --git a/nss_n2h.c b/nss_n2h.c
index cecfc82..54df82b 100644
--- a/nss_n2h.c
+++ b/nss_n2h.c
@@ -123,7 +123,7 @@
  */
 static void nss_n2h_interface_handler(struct nss_ctx_instance *nss_ctx,
 					struct nss_cmn_msg *ncm,
-					__attribute__((unused))void *app_data)
+					void *app_data)
 {
 	struct nss_n2h_msg *nnm = (struct nss_n2h_msg *)ncm;
 	nss_n2h_msg_callback_t cb;
@@ -321,7 +321,7 @@
 static void nss_n2h_set_wifi_payloads_callback(void *app_data,
 					struct nss_n2h_msg *nnm)
 {
-	struct nss_ctx_instance *nss_ctx = (struct nss_ctx_instance *)app_data;
+	struct nss_ctx_instance *nss_ctx __maybe_unused = (struct nss_ctx_instance *)app_data;
 	if (nnm->cm.response != NSS_CMN_RESPONSE_ACK) {
 
 		nss_n2h_wp.response = NSS_FAILURE;
diff --git a/nss_stats.c b/nss_stats.c
index edfe15f..7106acf 100644
--- a/nss_stats.c
+++ b/nss_stats.c
@@ -1098,8 +1098,6 @@
  */
 static ssize_t nss_stats_edma_port_type_read(struct file *fp, char __user *ubuf, size_t sz, loff_t *ppos)
 {
-	int32_t i;
-
 	/*
 	 * max output lines = #stats + start tag line + end tag line + three blank lines
 	 */
@@ -3469,19 +3467,19 @@
 			return;
 		}
 
-		edma_port_stats_d = debugfs_create_file("stats", 0400, edma_port_d, i, &nss_stats_edma_port_stats_ops);
+		edma_port_stats_d = debugfs_create_file("stats", 0400, edma_port_d, (void *)i, &nss_stats_edma_port_stats_ops);
 		if (unlikely(edma_port_stats_d == NULL)) {
 			nss_warning("Failed to create qca-nss-drv/stats/edma/ports/%d/stats file in debugfs", i);
 			return;
 		}
 
-		edma_port_type_d = debugfs_create_file("type", 0400, edma_port_d, i, &nss_stats_edma_port_type_ops);
+		edma_port_type_d = debugfs_create_file("type", 0400, edma_port_d, (void *)i, &nss_stats_edma_port_type_ops);
 		if (unlikely(edma_port_type_d == NULL)) {
 			nss_warning("Failed to create qca-nss-drv/stats/edma/ports/%d/type file in debugfs", i);
 			return;
 		}
 
-		edma_port_ring_map_d = debugfs_create_file("ring_map", 0400, edma_port_d, i, &nss_stats_edma_port_ring_map_ops);
+		edma_port_ring_map_d = debugfs_create_file("ring_map", 0400, edma_port_d, (void *)i, &nss_stats_edma_port_ring_map_ops);
 		if (unlikely(edma_port_ring_map_d == NULL)) {
 			nss_warning("Failed to create qca-nss-drv/stats/edma/ports/%d/ring_map file in debugfs", i);
 			return;
@@ -3510,7 +3508,7 @@
 		memset(file_name, 0, sizeof(file_name));
 		scnprintf(file_name, sizeof(file_name), "%d", i);
 		edma_tx_d = NULL;
-		edma_tx_d = debugfs_create_file(file_name, 0400, edma_tx_dir_d, i, &nss_stats_edma_txring_ops);
+		edma_tx_d = debugfs_create_file(file_name, 0400, edma_tx_dir_d, (void *)i, &nss_stats_edma_txring_ops);
 		if (unlikely(edma_tx_d == NULL)) {
 			nss_warning("Failed to create qca-nss-drv/stats/edma/rings/tx/%d file in debugfs", i);
 			return;
@@ -3530,7 +3528,7 @@
 		memset(file_name, 0, sizeof(file_name));
 		scnprintf(file_name, sizeof(file_name), "%d", i);
 		edma_rx_d = NULL;
-		edma_rx_d = debugfs_create_file(file_name, 0400, edma_rx_dir_d, i, &nss_stats_edma_rxring_ops);
+		edma_rx_d = debugfs_create_file(file_name, 0400, edma_rx_dir_d, (void *)i, &nss_stats_edma_rxring_ops);
 		if (unlikely(edma_rx_d == NULL)) {
 			nss_warning("Failed to create qca-nss-drv/stats/edma/rings/rx/%d file in debugfs", i);
 			return;
@@ -3550,7 +3548,7 @@
 		memset(file_name, 0, sizeof(file_name));
 		scnprintf(file_name, sizeof(file_name), "%d", i);
 		edma_txcmpl_d = NULL;
-		edma_txcmpl_d = debugfs_create_file(file_name, 0400, edma_txcmpl_dir_d, i, &nss_stats_edma_txcmplring_ops);
+		edma_txcmpl_d = debugfs_create_file(file_name, 0400, edma_txcmpl_dir_d, (void *)i, &nss_stats_edma_txcmplring_ops);
 		if (unlikely(edma_txcmpl_d == NULL)) {
 			nss_warning("Failed to create qca-nss-drv/stats/edma/rings/txcmpl/%d file in debugfs", i);
 			return;
@@ -3570,7 +3568,7 @@
 		memset(file_name, 0, sizeof(file_name));
 		scnprintf(file_name, sizeof(file_name), "%d", i);
 		edma_rxfill_d = NULL;
-		edma_rxfill_d = debugfs_create_file(file_name, 0400, edma_rxfill_dir_d, i, &nss_stats_edma_rxfillring_ops);
+		edma_rxfill_d = debugfs_create_file(file_name, 0400, edma_rxfill_dir_d, (void *)i, &nss_stats_edma_rxfillring_ops);
 		if (unlikely(edma_rxfill_d == NULL)) {
 			nss_warning("Failed to create qca-nss-drv/stats/edma/rings/rxfill/%d file in debugfs", i);
 			return;
diff --git a/nss_tx_rx_virt_if.c b/nss_tx_rx_virt_if.c
index 1d0f5bc..fba33ac 100644
--- a/nss_tx_rx_virt_if.c
+++ b/nss_tx_rx_virt_if.c
@@ -63,7 +63,7 @@
  */
 static void nss_tx_rx_virt_if_msg_handler(struct nss_ctx_instance *nss_ctx,
 					struct nss_cmn_msg *ncm,
-					__attribute__((unused))void *app_data)
+					void *app_data)
 {
 	struct nss_tx_rx_virt_if_msg *nvim = (struct nss_tx_rx_virt_if_msg *)ncm;
 	int32_t if_num;
@@ -523,11 +523,10 @@
 	nss_tx_status_t status;
 	int32_t if_num = handle->if_num;
 	int32_t index = NSS_TX_RX_VIRT_IF_GET_INDEX(if_num);
-	struct nss_ctx_instance *nss_ctx = handle->nss_ctx;
 
 	status = nss_dynamic_interface_dealloc_node(if_num, NSS_DYNAMIC_INTERFACE_TYPE_VIRTIF_DEPRECATED);
 	if (status != NSS_TX_SUCCESS) {
-		nss_warning("%p: Dynamic interface destroy failed status %d\n", nss_ctx, status);
+		nss_warning("%p: Dynamic interface destroy failed status %d\n", handle->nss_ctx, status);
 		return status;
 	}
 
diff --git a/nss_virt_if.c b/nss_virt_if.c
index f0bfaae..3910eb5 100644
--- a/nss_virt_if.c
+++ b/nss_virt_if.c
@@ -61,7 +61,7 @@
  */
 static void nss_virt_if_msg_handler(struct nss_ctx_instance *nss_ctx,
 					struct nss_cmn_msg *ncm,
-					__attribute__((unused))void *app_data)
+					void *app_data)
 {
 	struct nss_virt_if_msg *nvim = (struct nss_virt_if_msg *)ncm;
 	int32_t if_num;
@@ -295,11 +295,10 @@
 	nss_tx_status_t status;
 	int32_t if_num = handle->if_num;
 	int32_t index = NSS_VIRT_IF_GET_INDEX(if_num);
-	struct nss_ctx_instance *nss_ctx = handle->nss_ctx;
 
 	status = nss_dynamic_interface_dealloc_node(if_num, NSS_DYNAMIC_INTERFACE_TYPE_802_3_REDIR);
 	if (status != NSS_TX_SUCCESS) {
-		nss_warning("%p: Dynamic interface destroy failed status %d\n", nss_ctx, status);
+		nss_warning("%p: Dynamic interface destroy failed status %d\n", handle->nss_ctx, status);
 		return status;
 	}