Subject: [PATCH 20/62] octeontx2-pf: Fix locking in an error path

From: Bart Van Assche <[email-masked]>
Date: Mon, 23 Feb 2026 14:00:20 -0800

From: Bart Van Assche <[email-masked]>

Only unlock pf->mbox.lock if it has been locked by otx2_do_set_vf_vlan().
This bug has been detected by the Clang thread-safety analyzer.

Cc: Naveen Mamindlapalli <[email-masked]>
Cc: Jakub Kicinski <[email-masked]>
Cc: Sunil Goutham <[email-masked]>
Cc: Geetha sowjanya <[email-masked]>
Cc: Subbaraya Sundeep <[email-masked]>
Cc: hariprasad <[email-masked]>
Cc: Bharat Bhushan <[email-masked]>
Cc: [email-masked]
Fixes: f0c2982aaf98 ("octeontx2-pf: Add support for SR-IOV management functions")
Signed-off-by: Bart Van Assche <[email-masked]>
---
 drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
index ee623476e5ff..8c9f08ed90fd 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
@@ -2588,7 +2588,7 @@ static int otx2_do_set_vf_vlan(struct otx2_nic *pf, int vf, u16 vlan, u8 qos,
 	config = &pf->vf_configs[vf];
 
 	if (!vlan && !config->vlan)
-		goto out;
+		return err;
 
 	mutex_lock(&pf->mbox.lock);