diff mbox

[v3,01/21] rsi: use BUILD_BUG_ON check for fsm_state

Message ID 1499351844-2046-2-git-send-email-amitkarwar@gmail.com (mailing list archive)
State Accepted
Commit e0d0ae8a4304ce6be488570d085bef278fe941dd
Delegated to: Kalle Valo
Headers show

Commit Message

Amitkumar Karwar July 6, 2017, 2:37 p.m. UTC
From: Amitkumar Karwar <amit.karwar@redpinesignals.com>

Whenever new fsm_state enum element is added, fsm_state array
also needs to be updated. If this change is missed, we may end
up doing invalid access in array. BUILD_BUG_ON check will help
to avoid this problem.

Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
---
 drivers/net/wireless/rsi/rsi_91x_debugfs.c | 2 ++
 drivers/net/wireless/rsi/rsi_main.h        | 4 +++-
 2 files changed, 5 insertions(+), 1 deletion(-)

Comments

Kalle Valo July 28, 2017, 2:24 p.m. UTC | #1
Amitkumar Karwar <amitkarwar@gmail.com> wrote:

> From: Amitkumar Karwar <amit.karwar@redpinesignals.com>
> 
> Whenever new fsm_state enum element is added, fsm_state array
> also needs to be updated. If this change is missed, we may end
> up doing invalid access in array. BUILD_BUG_ON check will help
> to avoid this problem.
> 
> Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>

21 patches applied to wireless-drivers-next.git, thanks.

e0d0ae8a4304 rsi: use BUILD_BUG_ON check for fsm_state
09cfb41f3579 rsi: changes in eeprom read frame
f95bbd979df7 rsi: fix sdio card reset problem
49ddac0d4b80 rsi: chip reset for SDIO interface
f746606a51ed rsi: correct SDIO disconnect path handling
ea0676c47085 rsi: card reset for USB interface
ed833be6faa0 rsi: USB tx headroom cleanup
ac6107caa0d8 rsi: correct the logic of deriving queue number
5d16a1c1ae11 rsi: rename USB endpoint macros
d1f69e418f66 rsi: choose correct endpoint based on queue.
015240018b0a rsi: set immediate wakeup bit
de2dea16ec9f rsi: management frame descriptor preparation cleanup
6507de6df900 rsi: separate function for management packet descriptor
af1930977678 rsi: data packet descriptor code cleanup
0eb42586cf87 rsi: data packet descriptor enhancements
ceb2e4eab994 rsi: separate function for data packet descriptor
5f6ae7cae211 rsi: rename variable in_sdio_litefi_irq
72bccf51d459 rsi: Optimise sdio claim and release host
ebf084ea0ec7 rsi: SDIO Rx packet processing enhancement
6c409cad3d2b rsi: use separate mutex lock for receive thread
cb16453565f8 rsi: Rename mutex tx_rxlock to the tx_lock.
diff mbox

Patch

diff --git a/drivers/net/wireless/rsi/rsi_91x_debugfs.c b/drivers/net/wireless/rsi/rsi_91x_debugfs.c
index 4c0a493..f3b91b6 100644
--- a/drivers/net/wireless/rsi/rsi_91x_debugfs.c
+++ b/drivers/net/wireless/rsi/rsi_91x_debugfs.c
@@ -138,6 +138,8 @@  static int rsi_stats_read(struct seq_file *seq, void *data)
 	seq_puts(seq, "==> RSI STA DRIVER STATUS <==\n");
 	seq_puts(seq, "DRIVER_FSM_STATE: ");
 
+	BUILD_BUG_ON(ARRAY_SIZE(fsm_state) != NUM_FSM_STATES);
+
 	if (common->fsm_state <= FSM_MAC_INIT_DONE)
 		seq_printf(seq, "%s", fsm_state[common->fsm_state]);
 
diff --git a/drivers/net/wireless/rsi/rsi_main.h b/drivers/net/wireless/rsi/rsi_main.h
index f398525..72675eb 100644
--- a/drivers/net/wireless/rsi/rsi_main.h
+++ b/drivers/net/wireless/rsi/rsi_main.h
@@ -40,7 +40,9 @@  enum RSI_FSM_STATES {
 	FSM_RESET_MAC_SENT,
 	FSM_RADIO_CAPS_SENT,
 	FSM_BB_RF_PROG_SENT,
-	FSM_MAC_INIT_DONE
+	FSM_MAC_INIT_DONE,
+
+	NUM_FSM_STATES
 };
 
 extern u32 rsi_zone_enabled;