uart: add a null pointer check before dereferencing plat->adv_func
Signed-off-by: Tapani Utriainen <tapani@technexion.com> Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com>
This commit is contained in:
committed by
Alex Tereschenko
parent
8ddbcde84e
commit
e7b0a3e809
@@ -142,7 +142,7 @@ mraa_uart_init(int index)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (plat->adv_func->uart_init_pre != NULL) {
|
||||
if (plat->adv_func != NULL && plat->adv_func->uart_init_pre != NULL) {
|
||||
if (plat->adv_func->uart_init_pre(index) != MRAA_SUCCESS) {
|
||||
syslog(LOG_ERR, "uart%i: init: failure in pre-init platform hook", index);
|
||||
return NULL;
|
||||
|
||||
Reference in New Issue
Block a user