Skip to contentSkip to conversation

octeontx2-pf: unlock on error path in otx2_config_pause_frm()

PATCH Applied Dan Carpenter 2 participants 3 messages Mar 12, 2020 – Mar 13, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 octeontx2-pf: unlock on error path in otx2_config_pause_frm()

We need to unlock before returning if this allocation fails.

Fixes 75f36270990c ("octeontx2-pf: Support to enable/disable pause frames via ethtool")
---
 drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +5 -2
index af4437d4dfcb..157735443473 100644
@@ -227,14 +227,17 @@ int otx2_config_pause_frm(struct otx2_nic *pfvf)
 
 	otx2_mbox_lock(&pfvf->mbox);
 	req = otx2_mbox_alloc_msg_cgx_cfg_pause_frm(&pfvf->mbox);
-	if (!req)
-		return -ENOMEM;
+	if (!req) {
+		err = -ENOMEM;
+		goto unlock;
+	}
 
 	req->rx_pause = !!(pfvf->flags & OTX2_FLAG_RX_PAUSE_ENABLED);
 	req->tx_pause = !!(pfvf->flags & OTX2_FLAG_TX_PAUSE_ENABLED);
 	req->set = 1;
 
 	err = otx2_sync_mbox_msg(&pfvf->mbox);
+unlock:
 	otx2_mbox_unlock(&pfvf->mbox);
 	return err;
 }
Signature · 1 line
2.20.1
maintainer Applied
#1 lore raw

From: Dan Carpenter <[email protected]>
Date: Thu, 12 Mar 2020 14:30:48 +0300

Quoted 4 lines

We need to unlock before returning if this allocation fails.

Fixes 75f36270990c ("octeontx2-pf: Support to enable/disable pause frames via ethtool")

Applied to net-next.

Dan, please indicate the appropriate target tree in your Subject lines in the future. I have to dance around my GIT trees to figure out where your patches apply and that eats up more time than necessary.

Thanks.

#2 lore raw
Quoted 5 lines · David Miller

From: Dan Carpenter <[email protected]>
Date: Thu, 12 Mar 2020 14:30:48 +0300

Quoted 2 lines

We need to unlock before returning if this allocation fails.

Quoted 8 lines
Quoted 2 lines
Fixes 75f36270990c ("octeontx2-pf: Support to enable/disable pause frames via ethtool")

Applied to net-next.

Dan, please indicate the appropriate target tree in your Subject lines in the future. I have to dance around my GIT trees to figure out where your patches apply and that eats up more time than necessary.

Sorry, I've been trying to do that but I forgot. I'm going to update my QC scripts so hopefully it doesn't happen again.

regards,
dan carpenter