mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
spi: Suppress null pointer warning
Depending on defines px4_spi_buses can be NULL but often it's not and in those cases the compiler correctly warns about it.
This commit is contained in:
parent
a49f034757
commit
b8c2805263
@ -87,7 +87,12 @@ const px4_spi_bus_t *px4_spi_buses{nullptr};
|
||||
|
||||
int px4_find_spi_bus(uint32_t devid)
|
||||
{
|
||||
// px4_spi_buses is only NULL on certain targets depending on defines
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Waddress"
|
||||
|
||||
for (int i = 0; ((px4_spi_bus_t *) px4_spi_buses) != nullptr && i < SPI_BUS_MAX_BUS_ITEMS; ++i) {
|
||||
#pragma GCC diagnostic pop
|
||||
const px4_spi_bus_t &bus_data = px4_spi_buses[i];
|
||||
|
||||
if (bus_data.bus == -1) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user