summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2013-05-21 15:58:12 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2013-05-27 12:49:14 +0200
commit9344677cf45db5aac61066caec5cf4fc56c2b018 (patch)
treeb969004e9b1619f16cbae96c334f6c3590377c67
parentbsps/arm: Add CLOCK_DRIVER_USE_FAST_IDLE option (diff)
downloadrtems-9344677cf45db5aac61066caec5cf4fc56c2b018.tar.bz2
bsp/qoriq: Avoid NULL pointer access
-rw-r--r--c/src/lib/libbsp/powerpc/qoriq/console/console-config.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/c/src/lib/libbsp/powerpc/qoriq/console/console-config.c b/c/src/lib/libbsp/powerpc/qoriq/console/console-config.c
index 3947a27aba..b1d2847c5c 100644
--- a/c/src/lib/libbsp/powerpc/qoriq/console/console-config.c
+++ b/c/src/lib/libbsp/powerpc/qoriq/console/console-config.c
@@ -187,12 +187,18 @@ console_tbl Console_Configuration_Ports [CONSOLE_COUNT] = {
static void output_char(char c)
{
- const console_fns *con = Console_Port_Tbl [Console_Port_Minor]->pDeviceFns;
-
- if (c == '\n') {
- con->deviceWritePolled((int) Console_Port_Minor, '\r');
+ int minor = (int) Console_Port_Minor;
+ const console_tbl **ct_tbl = Console_Port_Tbl;
+
+ if (ct_tbl != NULL) {
+ const console_fns *cf = ct_tbl[minor]->pDeviceFns;
+
+ if (c == '\n') {
+ (*cf->deviceWritePolled)(minor, '\r');
+ }
+
+ (*cf->deviceWritePolled)(minor, c);
}
- con->deviceWritePolled((int) Console_Port_Minor, c);
}
BSP_output_char_function_type BSP_output_char = output_char;