rng: check error before checking if data ready.

mostly cosmetic, but ease debugging.
This commit is contained in:
Guillaume Revaillot 2019-02-05 14:35:18 +01:00 committed by Karl Palsson
parent 64baacfbbf
commit 5a53f18a78

View File

@ -67,13 +67,13 @@ void rng_interrupt_disable(void)
*/ */
bool rng_get_random(uint32_t *rand_nr) bool rng_get_random(uint32_t *rand_nr)
{ {
/* data ready */ /* Check for errors */
if (!(RNG_SR & RNG_SR_DRDY)) { if (RNG_SR & (RNG_SR_CECS | RNG_SR_SECS)) {
return false; return false;
} }
/* Check for errors */ /* data ready */
if (RNG_SR & (RNG_SR_CECS | RNG_SR_SECS)) { if (!(RNG_SR & RNG_SR_DRDY)) {
return false; return false;
} }