[v2] common/cnxk/roc_npa: unlock mbox in error cases
Checks
Commit Message
In npa_aura_pool_fini and in npa_aura_fini, Unlock mbox when an error is
detected.
Fixes: ea4d70cc4f0b46d5 ('common/cnxk: add NPA aura create/destroy ROC APIs')
Signed-off-by: Thierry Herbelot <thierry.herbelot@6wind.com>
--
V2: also patch npa_aura_pool_fini
---
drivers/common/cnxk/roc_npa.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
@@ -197,8 +197,10 @@ npa_aura_pool_fini(struct mbox *m_box, uint32_t aura_id, uint64_t aura_handle)
off = mbox->rx_start + pool_rsp->hdr.next_msgoff;
aura_rsp = (struct npa_aq_enq_rsp *)((uintptr_t)mdev->mbase + off);
- if (aura_rsp->hdr.rc != 0 || pool_rsp->hdr.rc != 0)
- return NPA_ERR_AURA_POOL_FINI;
+ if (aura_rsp->hdr.rc != 0 || pool_rsp->hdr.rc != 0){
+ rc = NPA_ERR_AURA_POOL_FINI;
+ goto exit;
+ }
/* Sync NDC-NPA for LF */
ndc_req = mbox_alloc_msg_ndc_sync_op(mbox);
@@ -245,8 +247,10 @@ npa_aura_fini(struct mbox *m_box, uint32_t aura_id)
if (rc < 0)
goto exit;
- if (aura_rsp->hdr.rc != 0)
- return NPA_ERR_AURA_POOL_FINI;
+ if (aura_rsp->hdr.rc != 0) {
+ rc = NPA_ERR_AURA_POOL_FINI;
+ goto exit;
+ }
/* Sync NDC-NPA for LF */
ndc_req = mbox_alloc_msg_ndc_sync_op(mbox);