* [PATCH] ASoC: ti: omap-mcbsp: Remove mixed goto/scoped cleanup handling
@ 2026-05-14 11:06 phucduc.bui
2026-05-15 0:16 ` Wang, Sen
0 siblings, 1 reply; 2+ messages in thread
From: phucduc.bui @ 2026-05-14 11:06 UTC (permalink / raw)
To: Mark Brown
Cc: Peter Ujfalusi, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
asahi, linux-sound, linux-kernel, linux-omap, bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
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.
Suggested-by: Mark Brown <broonie@kernel.org>
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
sound/soc/ti/omap-mcbsp.c | 46 +++++++++++++++++++--------------------
1 file changed, 22 insertions(+), 24 deletions(-)
diff --git a/sound/soc/ti/omap-mcbsp.c b/sound/soc/ti/omap-mcbsp.c
index d82fef629867..26af616c33f5 100644
--- a/sound/soc/ti/omap-mcbsp.c
+++ b/sound/soc/ti/omap-mcbsp.c
@@ -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)
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ASoC: ti: omap-mcbsp: Remove mixed goto/scoped cleanup handling
2026-05-14 11:06 [PATCH] ASoC: ti: omap-mcbsp: Remove mixed goto/scoped cleanup handling phucduc.bui
@ 2026-05-15 0:16 ` Wang, Sen
0 siblings, 0 replies; 2+ messages in thread
From: Wang, Sen @ 2026-05-15 0:16 UTC (permalink / raw)
To: phucduc.bui, Mark Brown
Cc: Peter Ujfalusi, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
asahi, linux-sound, linux-kernel, linux-omap
On 5/14/2026 6:06 AM, phucduc.bui@gmail.com wrote:
> From: bui duc phuc <phucduc.bui@gmail.com>
>
> 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.
>
> Suggested-by: Mark Brown <broonie@kernel.org>
> Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
> ---
> 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!
Acked-by: Sen Wang <sen@ti.com>
Best,
Sen Wang
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-05-15 0:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-14 11:06 [PATCH] ASoC: ti: omap-mcbsp: Remove mixed goto/scoped cleanup handling phucduc.bui
2026-05-15 0:16 ` Wang, Sen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.