From 40684b95d7dcbfd5cb15dbb0ee62d9881b77d6ea Mon Sep 17 00:00:00 2001 From: Jonathan Challinger Date: Tue, 23 Apr 2019 15:39:47 -0700 Subject: [PATCH] AP_BoardConfig: changes in response to review --- libraries/AP_BoardConfig/board_drivers.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libraries/AP_BoardConfig/board_drivers.cpp b/libraries/AP_BoardConfig/board_drivers.cpp index 34573ea82f..64181697f1 100644 --- a/libraries/AP_BoardConfig/board_drivers.cpp +++ b/libraries/AP_BoardConfig/board_drivers.cpp @@ -155,14 +155,16 @@ bool AP_BoardConfig::spi_check_register(const char *devname, uint8_t regnum, uin static bool check_ms5611(const char* devname) { auto dev = hal.spi->get_device(devname); - AP_HAL::Semaphore *dev_sem = dev->get_semaphore(); - if (!dev || !dev_sem) { + if (!dev) { #if SPI_PROBE_DEBUG hal.console->printf("%s: no device\n", devname); #endif return false; } - if (!dev_sem->take(HAL_SEMAPHORE_BLOCK_FOREVER)) { + + AP_HAL::Semaphore *dev_sem = dev->get_semaphore(); + + if (!dev_sem || !dev_sem->take(HAL_SEMAPHORE_BLOCK_FOREVER)) { return false; }