Fix populate_session() and its usage in tests
Fix populate_session() and its usage in tests

Not checking the return value allowed a bug to go undetected, fix the bug and
check the return value.

NXPmicro/mbedtls,NXPmicro/mbedtls,ARMmbed/mbedtls,ARMmbed/mbedtls,NXPmicro/mbedtls,ARMmbed/mbedtls,Mbed-TLS/mbedtls,Mbed-TLS/mbedtls,Mbed-TLS/mbedtls,NXPmicro/mbedtls,Mbed-TLS/mbedtls,ARMmbed/mbedtls