* [PATCH v2] ASoC: xtensa: Use dev_err_probe() and drop redundant error handling
@ 2026-07-09 4:37 phucduc.bui
2026-07-09 12:55 ` Max Filippov
2026-07-10 12:12 ` Mark Brown
0 siblings, 2 replies; 5+ messages in thread
From: phucduc.bui @ 2026-07-09 4:37 UTC (permalink / raw)
To: Max Filippov, Jaroslav Kysela, Takashi Iwai, Liam Girdwood,
Mark Brown
Cc: linux-sound, linux-kernel, bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
Convert error paths with messages to dev_err_probe(), which combines
dev_err() and the return statement while also handling -EPROBE_DEFER
for the clock path.
Remove the redundant "err:" label and return errors directly. Paths such
as platform_get_irq() already log failures in the callee, so they simply
return the error code without printing an additional message. Inline the
pm_runtime_disable() cleanup at its only call site.
No functional change.
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
sound/soc/xtensa/xtfpga-i2s.c | 60 +++++++++++++----------------------
1 file changed, 22 insertions(+), 38 deletions(-)
diff --git a/sound/soc/xtensa/xtfpga-i2s.c b/sound/soc/xtensa/xtfpga-i2s.c
index 9ad86c54e3ea..fd0990201b40 100644
--- a/sound/soc/xtensa/xtfpga-i2s.c
+++ b/sound/soc/xtensa/xtfpga-i2s.c
@@ -533,34 +533,25 @@ static int xtfpga_i2s_probe(struct platform_device *pdev)
int err, irq;
i2s = devm_kzalloc(&pdev->dev, sizeof(*i2s), GFP_KERNEL);
- if (!i2s) {
- err = -ENOMEM;
- goto err;
- }
+ if (!i2s)
+ return -ENOMEM;
+
platform_set_drvdata(pdev, i2s);
i2s->dev = &pdev->dev;
dev_dbg(&pdev->dev, "dev: %p, i2s: %p\n", &pdev->dev, i2s);
i2s->regs = devm_platform_ioremap_resource(pdev, 0);
- if (IS_ERR(i2s->regs)) {
- err = PTR_ERR(i2s->regs);
- goto err;
- }
+ if (IS_ERR(i2s->regs))
+ return PTR_ERR(i2s->regs);
i2s->regmap = devm_regmap_init_mmio(&pdev->dev, i2s->regs,
&xtfpga_i2s_regmap_config);
- if (IS_ERR(i2s->regmap)) {
- dev_err(&pdev->dev, "regmap init failed\n");
- err = PTR_ERR(i2s->regmap);
- goto err;
- }
+ if (IS_ERR(i2s->regmap))
+ return dev_err_probe(&pdev->dev, PTR_ERR(i2s->regmap), "regmap init failed\n");
i2s->clk = devm_clk_get(&pdev->dev, NULL);
- if (IS_ERR(i2s->clk)) {
- dev_err(&pdev->dev, "couldn't get clock\n");
- err = PTR_ERR(i2s->clk);
- goto err;
- }
+ if (IS_ERR(i2s->clk))
+ return dev_err_probe(&pdev->dev, PTR_ERR(i2s->clk), "couldn't get clock\n");
regmap_write(i2s->regmap, XTFPGA_I2S_CONFIG,
(0x1 << XTFPGA_I2S_CONFIG_CHANNEL_BASE));
@@ -568,41 +559,34 @@ static int xtfpga_i2s_probe(struct platform_device *pdev)
regmap_write(i2s->regmap, XTFPGA_I2S_INT_MASK, XTFPGA_I2S_INT_UNDERRUN);
irq = platform_get_irq(pdev, 0);
- if (irq < 0) {
- err = irq;
- goto err;
- }
+ if (irq < 0)
+ return irq;
+
err = devm_request_threaded_irq(&pdev->dev, irq, NULL,
xtfpga_i2s_threaded_irq_handler,
IRQF_SHARED | IRQF_ONESHOT,
pdev->name, i2s);
- if (err < 0) {
- dev_err(&pdev->dev, "request_irq failed\n");
- goto err;
- }
+ if (err < 0)
+ return err;
err = devm_snd_soc_register_component(&pdev->dev,
&xtfpga_i2s_component,
xtfpga_i2s_dai,
ARRAY_SIZE(xtfpga_i2s_dai));
- if (err < 0) {
- dev_err(&pdev->dev, "couldn't register component\n");
- goto err;
- }
+ if (err < 0)
+ return err;
+
pm_runtime_enable(&pdev->dev);
if (!pm_runtime_enabled(&pdev->dev)) {
err = xtfpga_i2s_runtime_resume(&pdev->dev);
- if (err)
- goto err_pm_disable;
+ if (err) {
+ pm_runtime_disable(&pdev->dev);
+ return err;
+ }
}
- return 0;
-err_pm_disable:
- pm_runtime_disable(&pdev->dev);
-err:
- dev_err(&pdev->dev, "%s: err = %d\n", __func__, err);
- return err;
+ return 0;
}
static void xtfpga_i2s_remove(struct platform_device *pdev)
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH v2] ASoC: xtensa: Use dev_err_probe() and drop redundant error handling
2026-07-09 4:37 [PATCH v2] ASoC: xtensa: Use dev_err_probe() and drop redundant error handling phucduc.bui
@ 2026-07-09 12:55 ` Max Filippov
2026-07-09 12:58 ` Max Filippov
2026-07-10 12:12 ` Mark Brown
1 sibling, 1 reply; 5+ messages in thread
From: Max Filippov @ 2026-07-09 12:55 UTC (permalink / raw)
To: phucduc.bui
Cc: Jaroslav Kysela, Takashi Iwai, Liam Girdwood, Mark Brown,
linux-sound, linux-kernel
On Wed, Jul 8, 2026 at 9:38 PM <phucduc.bui@gmail.com> wrote:
>
> From: bui duc phuc <phucduc.bui@gmail.com>
>
> Convert error paths with messages to dev_err_probe(), which combines
> dev_err() and the return statement while also handling -EPROBE_DEFER
> for the clock path.
> Remove the redundant "err:" label and return errors directly. Paths such
> as platform_get_irq() already log failures in the callee, so they simply
> return the error code without printing an additional message. Inline the
> pm_runtime_disable() cleanup at its only call site.
>
> No functional change.
>
> Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
> ---
> sound/soc/xtensa/xtfpga-i2s.c | 60 +++++++++++++----------------------
> 1 file changed, 22 insertions(+), 38 deletions(-)
>
> diff --git a/sound/soc/xtensa/xtfpga-i2s.c b/sound/soc/xtensa/xtfpga-i2s.c
> index 9ad86c54e3ea..fd0990201b40 100644
> --- a/sound/soc/xtensa/xtfpga-i2s.c
> +++ b/sound/soc/xtensa/xtfpga-i2s.c
> @@ -533,34 +533,25 @@ static int xtfpga_i2s_probe(struct platform_device *pdev)
> int err, irq;
>
> i2s = devm_kzalloc(&pdev->dev, sizeof(*i2s), GFP_KERNEL);
> - if (!i2s) {
> - err = -ENOMEM;
> - goto err;
> - }
> + if (!i2s)
> + return -ENOMEM;
> +
> platform_set_drvdata(pdev, i2s);
> i2s->dev = &pdev->dev;
> dev_dbg(&pdev->dev, "dev: %p, i2s: %p\n", &pdev->dev, i2s);
>
> i2s->regs = devm_platform_ioremap_resource(pdev, 0);
> - if (IS_ERR(i2s->regs)) {
> - err = PTR_ERR(i2s->regs);
> - goto err;
> - }
> + if (IS_ERR(i2s->regs))
> + return PTR_ERR(i2s->regs);
>
> i2s->regmap = devm_regmap_init_mmio(&pdev->dev, i2s->regs,
> &xtfpga_i2s_regmap_config);
> - if (IS_ERR(i2s->regmap)) {
> - dev_err(&pdev->dev, "regmap init failed\n");
> - err = PTR_ERR(i2s->regmap);
> - goto err;
> - }
> + if (IS_ERR(i2s->regmap))
> + return dev_err_probe(&pdev->dev, PTR_ERR(i2s->regmap), "regmap init failed\n");
>
> i2s->clk = devm_clk_get(&pdev->dev, NULL);
> - if (IS_ERR(i2s->clk)) {
> - dev_err(&pdev->dev, "couldn't get clock\n");
> - err = PTR_ERR(i2s->clk);
> - goto err;
> - }
> + if (IS_ERR(i2s->clk))
> + return dev_err_probe(&pdev->dev, PTR_ERR(i2s->clk), "couldn't get clock\n");
>
> regmap_write(i2s->regmap, XTFPGA_I2S_CONFIG,
> (0x1 << XTFPGA_I2S_CONFIG_CHANNEL_BASE));
> @@ -568,41 +559,34 @@ static int xtfpga_i2s_probe(struct platform_device *pdev)
> regmap_write(i2s->regmap, XTFPGA_I2S_INT_MASK, XTFPGA_I2S_INT_UNDERRUN);
>
> irq = platform_get_irq(pdev, 0);
> - if (irq < 0) {
> - err = irq;
> - goto err;
> - }
> + if (irq < 0)
> + return irq;
> +
> err = devm_request_threaded_irq(&pdev->dev, irq, NULL,
> xtfpga_i2s_threaded_irq_handler,
> IRQF_SHARED | IRQF_ONESHOT,
> pdev->name, i2s);
> - if (err < 0) {
> - dev_err(&pdev->dev, "request_irq failed\n");
> - goto err;
> - }
> + if (err < 0)
> + return err;
You convert other dev_err() calls to dev_err_probe(), why not this one?
> err = devm_snd_soc_register_component(&pdev->dev,
> &xtfpga_i2s_component,
> xtfpga_i2s_dai,
> ARRAY_SIZE(xtfpga_i2s_dai));
> - if (err < 0) {
> - dev_err(&pdev->dev, "couldn't register component\n");
> - goto err;
> - }
> + if (err < 0)
> + return err;
> +
Or this one?
--
Thanks.
-- Max
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH v2] ASoC: xtensa: Use dev_err_probe() and drop redundant error handling
2026-07-09 12:55 ` Max Filippov
@ 2026-07-09 12:58 ` Max Filippov
2026-07-10 5:11 ` Bui Duc Phuc
0 siblings, 1 reply; 5+ messages in thread
From: Max Filippov @ 2026-07-09 12:58 UTC (permalink / raw)
To: phucduc.bui
Cc: Jaroslav Kysela, Takashi Iwai, Liam Girdwood, Mark Brown,
linux-sound, linux-kernel
On Thu, Jul 9, 2026 at 5:55 AM Max Filippov <jcmvbkbc@gmail.com> wrote:
>
> On Wed, Jul 8, 2026 at 9:38 PM <phucduc.bui@gmail.com> wrote:
> >
> > From: bui duc phuc <phucduc.bui@gmail.com>
> >
> > Convert error paths with messages to dev_err_probe(), which combines
> > dev_err() and the return statement while also handling -EPROBE_DEFER
> > for the clock path.
> > Remove the redundant "err:" label and return errors directly. Paths such
> > as platform_get_irq() already log failures in the callee, so they simply
> > return the error code without printing an additional message. Inline the
> > pm_runtime_disable() cleanup at its only call site.
> >
> > No functional change.
> >
> > Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
> > ---
> > sound/soc/xtensa/xtfpga-i2s.c | 60 +++++++++++++----------------------
> > 1 file changed, 22 insertions(+), 38 deletions(-)
> >
> > diff --git a/sound/soc/xtensa/xtfpga-i2s.c b/sound/soc/xtensa/xtfpga-i2s.c
> > index 9ad86c54e3ea..fd0990201b40 100644
> > --- a/sound/soc/xtensa/xtfpga-i2s.c
> > +++ b/sound/soc/xtensa/xtfpga-i2s.c
> > @@ -533,34 +533,25 @@ static int xtfpga_i2s_probe(struct platform_device *pdev)
> > int err, irq;
> >
> > i2s = devm_kzalloc(&pdev->dev, sizeof(*i2s), GFP_KERNEL);
> > - if (!i2s) {
> > - err = -ENOMEM;
> > - goto err;
> > - }
> > + if (!i2s)
> > + return -ENOMEM;
> > +
> > platform_set_drvdata(pdev, i2s);
> > i2s->dev = &pdev->dev;
> > dev_dbg(&pdev->dev, "dev: %p, i2s: %p\n", &pdev->dev, i2s);
> >
> > i2s->regs = devm_platform_ioremap_resource(pdev, 0);
> > - if (IS_ERR(i2s->regs)) {
> > - err = PTR_ERR(i2s->regs);
> > - goto err;
> > - }
> > + if (IS_ERR(i2s->regs))
> > + return PTR_ERR(i2s->regs);
> >
> > i2s->regmap = devm_regmap_init_mmio(&pdev->dev, i2s->regs,
> > &xtfpga_i2s_regmap_config);
> > - if (IS_ERR(i2s->regmap)) {
> > - dev_err(&pdev->dev, "regmap init failed\n");
> > - err = PTR_ERR(i2s->regmap);
> > - goto err;
> > - }
> > + if (IS_ERR(i2s->regmap))
> > + return dev_err_probe(&pdev->dev, PTR_ERR(i2s->regmap), "regmap init failed\n");
> >
> > i2s->clk = devm_clk_get(&pdev->dev, NULL);
> > - if (IS_ERR(i2s->clk)) {
> > - dev_err(&pdev->dev, "couldn't get clock\n");
> > - err = PTR_ERR(i2s->clk);
> > - goto err;
> > - }
> > + if (IS_ERR(i2s->clk))
> > + return dev_err_probe(&pdev->dev, PTR_ERR(i2s->clk), "couldn't get clock\n");
> >
> > regmap_write(i2s->regmap, XTFPGA_I2S_CONFIG,
> > (0x1 << XTFPGA_I2S_CONFIG_CHANNEL_BASE));
> > @@ -568,41 +559,34 @@ static int xtfpga_i2s_probe(struct platform_device *pdev)
> > regmap_write(i2s->regmap, XTFPGA_I2S_INT_MASK, XTFPGA_I2S_INT_UNDERRUN);
> >
> > irq = platform_get_irq(pdev, 0);
> > - if (irq < 0) {
> > - err = irq;
> > - goto err;
> > - }
> > + if (irq < 0)
> > + return irq;
> > +
> > err = devm_request_threaded_irq(&pdev->dev, irq, NULL,
> > xtfpga_i2s_threaded_irq_handler,
> > IRQF_SHARED | IRQF_ONESHOT,
> > pdev->name, i2s);
> > - if (err < 0) {
> > - dev_err(&pdev->dev, "request_irq failed\n");
> > - goto err;
> > - }
> > + if (err < 0)
> > + return err;
>
> You convert other dev_err() calls to dev_err_probe(), why not this one?
>
> > err = devm_snd_soc_register_component(&pdev->dev,
> > &xtfpga_i2s_component,
> > xtfpga_i2s_dai,
> > ARRAY_SIZE(xtfpga_i2s_dai));
> > - if (err < 0) {
> > - dev_err(&pdev->dev, "couldn't register component\n");
> > - goto err;
> > - }
> > + if (err < 0)
> > + return err;
> > +
>
> Or this one?
Doh, the answer's in the change description.
Reviewed-by: Max Filippov <jcmvbkbc@gmail.com>
--
Thanks.
-- Max
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] ASoC: xtensa: Use dev_err_probe() and drop redundant error handling
2026-07-09 4:37 [PATCH v2] ASoC: xtensa: Use dev_err_probe() and drop redundant error handling phucduc.bui
2026-07-09 12:55 ` Max Filippov
@ 2026-07-10 12:12 ` Mark Brown
1 sibling, 0 replies; 5+ messages in thread
From: Mark Brown @ 2026-07-10 12:12 UTC (permalink / raw)
To: Max Filippov, Jaroslav Kysela, Takashi Iwai, Liam Girdwood,
phucduc.bui
Cc: linux-sound, linux-kernel
On Thu, 09 Jul 2026 11:37:40 +0700, phucduc.bui@gmail.com wrote:
> ASoC: xtensa: Use dev_err_probe() and drop redundant error handling
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.3
Thanks!
[1/1] ASoC: xtensa: Use dev_err_probe() and drop redundant error handling
https://git.kernel.org/broonie/sound/c/92aa9c7b1d9d
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
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-07-10 22:21 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-09 4:37 [PATCH v2] ASoC: xtensa: Use dev_err_probe() and drop redundant error handling phucduc.bui
2026-07-09 12:55 ` Max Filippov
2026-07-09 12:58 ` Max Filippov
2026-07-10 5:11 ` Bui Duc Phuc
2026-07-10 12:12 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox