Skip to contentSkip to conversation

ASoC: ti: omap-mcbsp: Remove mixed goto/scoped cleanup handling

PATCH In review [email protected] 3 participants 3 messages May 14 – May 15

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

PATCH 1/1 ASoC: ti: omap-mcbsp: Remove mixed goto/scoped cleanup handling

From: bui duc phuc <[email protected]>

After converting to guard()/scoped_guard() helpers, omap_mcbsp_request() still mixes scoped cleanup with goto based error handling.

Remove the remaining goto based cleanup paths for a more consistent cleanup flow.

---
 sound/soc/ti/omap-mcbsp.c | 46 +++++++++++++++++++--------------------
 1 file changed, 22 insertions(+), 24 deletions(-)
sound/soc/ti/omap-mcbsp.c +22 -24
index d82fef629867..26af616c33f5 100644
@@ -307,7 +307,7 @@ static int omap_mcbsp_request(struct omap_mcbsp *mcbsp)
 		reg_cache = NULL;
 	}
 
-	if(mcbsp->pdata->ops && mcbsp->pdata->ops->request)
+	if (mcbsp->pdata->ops && mcbsp->pdata->ops->request)
 		mcbsp->pdata->ops->request(mcbsp->id - 1);
 
 	/*
@@ -322,42 +322,40 @@ static int omap_mcbsp_request(struct omap_mcbsp *mcbsp)
 				  "McBSP", (void *)mcbsp);
 		if (err != 0) {
 			dev_err(mcbsp->dev, "Unable to request IRQ\n");
-			goto err_clk_disable;
 		}
 	} else {
 		err = request_irq(mcbsp->tx_irq, omap_mcbsp_tx_irq_handler, 0,
 				  "McBSP TX", (void *)mcbsp);
 		if (err != 0) {
 			dev_err(mcbsp->dev, "Unable to request TX IRQ\n");
-			goto err_clk_disable;
-		}
-
-		err = request_irq(mcbsp->rx_irq, omap_mcbsp_rx_irq_handler, 0,
-				  "McBSP RX", (void *)mcbsp);
-		if (err != 0) {
-			dev_err(mcbsp->dev, "Unable to request RX IRQ\n");
-			goto err_free_irq;
+		} else {
+			err = request_irq(mcbsp->rx_irq, omap_mcbsp_rx_irq_handler, 0,
+					  "McBSP RX", (void *)mcbsp);
+			if (err != 0) {
+				dev_err(mcbsp->dev, "Unable to request RX IRQ\n");
+				free_irq(mcbsp->tx_irq, (void *)mcbsp);
+			}
 		}
 	}
 
-	return 0;
-err_free_irq:
-	free_irq(mcbsp->tx_irq, (void *)mcbsp);
-err_clk_disable:
-	if(mcbsp->pdata->ops && mcbsp->pdata->ops->free)
-		mcbsp->pdata->ops->free(mcbsp->id - 1);
+	if (err != 0) {
+		if (mcbsp->pdata->ops && mcbsp->pdata->ops->free)
+			mcbsp->pdata->ops->free(mcbsp->id - 1);
 
-	/* Disable wakeup behavior */
-	if (mcbsp->pdata->has_wakeup)
-		MCBSP_WRITE(mcbsp, WAKEUPEN, 0);
+		/* Disable wakeup behavior */
+		if (mcbsp->pdata->has_wakeup)
+			MCBSP_WRITE(mcbsp, WAKEUPEN, 0);
 
-	scoped_guard(spinlock, &mcbsp->lock) {
-		reg_cache = mcbsp->reg_cache;
-		mcbsp->free = true;
-		mcbsp->reg_cache = NULL;
+		scoped_guard(spinlock, &mcbsp->lock) {
+			reg_cache = mcbsp->reg_cache;
+			mcbsp->free = true;
+			mcbsp->reg_cache = NULL;
+		}
+
+		return err;
 	}
 
-	return err;
+	return 0;
 }
 
 static void omap_mcbsp_free(struct omap_mcbsp *mcbsp)
Signature · 1 line
2.43.0
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · On 5/14/2026 6:06 AM, [email protected] wrote:

From: bui duc phuc <[email protected]>

After converting to guard()/scoped_guard() helpers, omap_mcbsp_request() still mixes scoped cleanup with goto based error handling.

Quoted 9 lines

Remove the remaining goto based cleanup paths for a more consistent cleanup flow.

---
  sound/soc/ti/omap-mcbsp.c | 46 +++++++++++++++++++--------------------
  1 file changed, 22 insertions(+), 24 deletions(-)

Hi bui duc phuc,

The logic looks good to me, thanks for your cleanup!

Best,
Sen Wang

maintainer
#2 lore raw
In reply to [email protected]
Quoted 1 line · On Thu, 14 May 2026 18:06:02 +0700, [email protected] wrote:

ASoC: ti: omap-mcbsp: Remove mixed goto/scoped cleanup handling

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.2

Thanks!

[1/1] ASoC: ti: omap-mcbsp: Remove mixed goto/scoped cleanup handling

      https://git.kernel.org/broonie/sound/c/7c0acb8f766a

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark