replacing __ASSERT with an if statement cause the if to always pass

hello Nordic 

i am working with nrf52840 with ncs 1.7 (moving to 1.8 soon) 

i am trying to clean my code from assertions before production 

for some reasong when i change this lines:

__ASSERT(0 == k_sem_take(&spi_data->spi_xfer_sem, K_MSEC(5000)), "timeout on k_sem_take of spi_xfer_sem");

to this:

ret = k_sem_take(&spi_data->spi_xfer_sem, K_MSEC(5000));
if( 0 != ret )
{
	LOG_ERR("augu_spi_xfer - timeout on k_sem_take of spi_xfer_sem");
	return ret;
}

then even if i change the codition to " 0 != ret" i always get inside the if statement 

this is vary odd and i wonder what i am missing

hope to read from you soon

best regards

Ziv

Parents Reply Children
Related