bdk: tsec: homogenize return values

This commit is contained in:
CTCaer
2026-02-22 03:10:18 +02:00
parent d286af0647
commit 0b7415f6d4

View File

@@ -44,9 +44,9 @@ static int _tsec_dma_wait_idle()
while (!(TSEC(TSEC_DMATRFCMD) & TSEC_DMATRFCMD_IDLE)) while (!(TSEC(TSEC_DMATRFCMD) & TSEC_DMATRFCMD_IDLE))
if (get_tmr_ms() > timeout) if (get_tmr_ms() > timeout)
return 0;
return 1; return 1;
return 0;
} }
static int _tsec_dma_pa_to_internal_100(int not_imem, int i_offset, int pa_offset) static int _tsec_dma_pa_to_internal_100(int not_imem, int i_offset, int pa_offset)
@@ -116,7 +116,7 @@ int tsec_query(void *tsec_keys, tsec_ctxt_t *tsec_ctxt)
TSEC_IRQDEST_SWGEN0 | TSEC_IRQDEST_SWGEN0 |
TSEC_IRQDEST_SWGEN1; TSEC_IRQDEST_SWGEN1;
TSEC(TSEC_ITFEN) = TSEC_ITFEN_CTXEN | TSEC_ITFEN_MTHDEN; TSEC(TSEC_ITFEN) = TSEC_ITFEN_CTXEN | TSEC_ITFEN_MTHDEN;
if (!_tsec_dma_wait_idle()) if (_tsec_dma_wait_idle())
{ {
res = -1; res = -1;
goto out; goto out;
@@ -136,7 +136,7 @@ int tsec_query(void *tsec_keys, tsec_ctxt_t *tsec_ctxt)
for (u32 addr = 0; addr < tsec_ctxt->size; addr += 0x100) for (u32 addr = 0; addr < tsec_ctxt->size; addr += 0x100)
{ {
if (!_tsec_dma_pa_to_internal_100(false, addr, addr)) if (_tsec_dma_pa_to_internal_100(false, addr, addr))
{ {
res = -2; res = -2;
goto out_free; goto out_free;
@@ -257,7 +257,7 @@ int tsec_query(void *tsec_keys, tsec_ctxt_t *tsec_ctxt)
} }
else else
{ {
if (!_tsec_dma_wait_idle()) if (_tsec_dma_wait_idle())
{ {
res = -3; res = -3;
goto out_free; goto out_free;