random: ctr_drbg: Fix the error path in sys_csrand_get

When ctr_drbg_initialize fails the function returns without unlock irq
that was previously locked.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
Flavio Ceolin 2020-11-11 10:42:51 -08:00 committed by Maureen Helm
commit b6ef0c0d94

View file

@ -112,7 +112,8 @@ int z_impl_sys_csrand_get(void *dst, uint32_t outlen)
if (unlikely(!entropy_driver)) {
ret = ctr_drbg_initialize();
if (ret != 0) {
return ret;
ret = -EIO;
goto end;
}
}
@ -150,8 +151,8 @@ int z_impl_sys_csrand_get(void *dst, uint32_t outlen)
} else {
ret = -EIO;
}
end:
#endif
end:
irq_unlock(key);
return ret;