fiq_debugger: Sanity check state in fiq_tty_proc_show

The fiq_tty_proc_show can be called even when fiq is not enabled in dts,
which would cause crash.

Add sanity check to avoid that.

Change-Id: I69d34718f91813aed14c542901060e4fd68b818b
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
This commit is contained in:
Jeffy Chen
2018-08-16 20:10:33 +08:00
committed by Tao Huang
parent 0f7a971a79
commit 77e938e49d

View File

@@ -1217,6 +1217,8 @@ static int fiq_tty_proc_show(struct seq_file *m, void *v)
seq_puts(m, "fiq-debugger driver\n");
for (i = 0; i < MAX_FIQ_DEBUGGER_PORTS; i++) {
state = states[i];
if (!state)
continue;
seq_printf(m, "%d:", i);
seq_printf(m, " state:%d", state->console_enable);