ASoC: tegra: Simplify error handling
Subsystems (3)
cover ASoC: tegra: Simplify error handling
From: bui duc phuc <[email protected]>
Hi all,
This series contains a few small cleanups for the Tegra ASoC drivers.
- Use dev_err_probe() for regmap initialization failures.
- Return the original error from snd_soc_add_component_controls().
- Use devm_clk_get_optional() for the optional sync_input clock.
Overall, this simplifies the error paths and makes the code more consistent.
Best regards,
Phuc
bui duc phuc (4):
ASoC: tegra: tegra20_das: Use dev_err_probe() for error handling
ASoC: tegra: tegra210_adx: Return the original error directly
ASoC: tegra: tegra210_amx: Return the original error directly
ASoC: tegra: tegra210: Use devm_clk_get_optional() for sync_input
clock
sound/soc/tegra/tegra20_das.c | 7 +++---- sound/soc/tegra/tegra210_adx.c | 12 ++++-------- sound/soc/tegra/tegra210_amx.c | 12 ++++-------- sound/soc/tegra/tegra210_i2s.c | 10 +++++----- 4 files changed, 16 insertions(+), 25 deletions(-)
Signature · 1 line
2.43.0
PATCH 1/4 ASoC: tegra: tegra20_das: Use dev_err_probe() for error handling
From: bui duc phuc <[email protected]>
Replace the existing dev_err() and PTR_ERR() sequence with dev_err_probe(), preserving the original error code while simplifying the error handling.
--- sound/soc/tegra/tegra20_das.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
sound/soc/tegra/tegra20_das.c +3 -4
@@ -167,10 +167,9 @@ static int tegra20_das_probe(struct platform_device *pdev) das->regmap =devm_regmap_init_mmio (&pdev->dev, regs, &tegra20_das_regmap_config); -if (IS_ERR (das->regmap)) { -dev_err (&pdev->dev,"regmap init failed\n" ); -return PTR_ERR (das->regmap); - } +if (IS_ERR (das->regmap)) +return dev_err_probe (&pdev->dev,PTR_ERR (das->regmap), +"regmap init failed\n" );tegra20_das_connect_dap_to_dac (das,TEGRA20_DAS_DAP_ID_1 ,TEGRA20_DAS_DAP_SEL_DAC1 );
Signature · 1 line
2.43.0
Re: [PATCH 1/4] ASoC: tegra: tegra20_das: Use dev_err_probe() for error handling
Quoted 10 lines · On Wed, Jul 15, 2026 at 12:11:12PM +0700, [email protected] wrote:
From: bui duc phuc <[email protected]>
Replace the existing
dev_err()andPTR_ERR()sequence withdev_err_probe(), preserving the original error code while simplifying the error handling.Signed-off-by bui duc phuc <[email protected]>--- sound/soc/tegra/tegra20_das.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
PATCH 2/4 ASoC: tegra: tegra210_adx: Return the original error directly
In reply to [email protected]From: bui duc phuc <[email protected]>
snd_soc_add_component_controls() already reports failures internally. Return its error code directly instead of logging the error again in the component probe callback. Also remove the now unnecessary local error variable.
--- sound/soc/tegra/tegra210_adx.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
sound/soc/tegra/tegra210_adx.c +4 -8
@@ -496,16 +496,12 @@ static struct snd_kcontrol_new tegra264_adx_controls[] = {static int tegra210_adx_component_probe (struct snd_soc_component *component) {struct tegra210_adx *adx =snd_soc_component_get_drvdata (component); -int err =0 ; -if (adx->soc_data->num_controls) { - err =snd_soc_add_component_controls (component, adx->soc_data->controls, - adx->soc_data->num_controls); -if (err) -dev_err (component->dev,"can't add ADX controls, err: %d\n" , err); - } +if (adx->soc_data->num_controls) +return snd_soc_add_component_controls (component, adx->soc_data->controls, + adx->soc_data->num_controls); -return err; +return 0 ; }static const struct snd_soc_component_driver tegra210_adx_cmpnt = {
Signature · 1 line
2.43.0
Re: [PATCH 2/4] ASoC: tegra: tegra210_adx: Return the original error directly
Quoted 11 lines · On Wed, Jul 15, 2026 at 12:11:13PM +0700, [email protected] wrote:
From: bui duc phuc <[email protected]>
snd_soc_add_component_controls()already reports failures internally. Return its error code directly instead of logging the error again in the component probe callback. Also remove the now unnecessary local error variable.Signed-off-by bui duc phuc <[email protected]>--- sound/soc/tegra/tegra210_adx.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
PATCH 3/4 ASoC: tegra: tegra210_amx: Return the original error directly
In reply to [email protected]From: bui duc phuc <[email protected]>
snd_soc_add_component_controls() already reports failures internally. Return its error code directly instead of logging the error again in the component probe callback. Also remove the now unnecessary local error variable.
--- sound/soc/tegra/tegra210_amx.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
sound/soc/tegra/tegra210_amx.c +4 -8
@@ -504,16 +504,12 @@ static struct snd_kcontrol_new tegra264_amx_controls[] = {static int tegra210_amx_component_probe (struct snd_soc_component *component) {struct tegra210_amx *amx =snd_soc_component_get_drvdata (component); -int err =0 ; -if (amx->soc_data->num_controls) { - err =snd_soc_add_component_controls (component, amx->soc_data->controls, - amx->soc_data->num_controls); -if (err) -dev_err (component->dev,"can't add AMX controls, err: %d\n" , err); - } +if (amx->soc_data->num_controls) +return snd_soc_add_component_controls (component, amx->soc_data->controls, + amx->soc_data->num_controls); -return err; +return 0 ; }static const struct snd_soc_component_driver tegra210_amx_cmpnt = {
Signature · 1 line
2.43.0
Re: [PATCH 3/4] ASoC: tegra: tegra210_amx: Return the original error directly
Quoted 11 lines · On Wed, Jul 15, 2026 at 12:11:14PM +0700, [email protected] wrote:
From: bui duc phuc <[email protected]>
snd_soc_add_component_controls()already reports failures internally. Return its error code directly instead of logging the error again in the component probe callback. Also remove the now unnecessary local error variable.Signed-off-by bui duc phuc <[email protected]>--- sound/soc/tegra/tegra210_amx.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
I suppose this could've been merged with the prior patch since it does effectively the same thing. In either case:
PATCH 4/4 ASoC: tegra: tegra210: Use devm_clk_get_optional() for sync_input clock
In reply to [email protected]From: bui duc phuc <[email protected]>
The existing comment states that the sync_input clock is only needed when another I/O is configured to use the current I2S instance as its input clock, and the current code does not treat its absence as an error.
Use devm_clk_get_optional() to match the existing behaviour while still reporting real failures via dev_err_probe(). Update the comment to describe the optional nature of the clock rather than the previous error handling.
--- sound/soc/tegra/tegra210_i2s.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
sound/soc/tegra/tegra210_i2s.c +5 -5
@@ -1078,13 +1078,13 @@ static int tegra210_i2s_probe(struct platform_device *pdev) "can't retrieve I2S bit clock\n");/* -* Not an error, as this clock is needed only when some other I/O -* requires input clock from current I2S instance, which is -* configurable from DT. +* This clock is optional and is only needed when another I/O uses +* the current I2S instance as its input clock, as configured in DT. */ - i2s->clk_sync_input =devm_clk_get (dev,"sync_input" ); + i2s->clk_sync_input =devm_clk_get_optional (dev,"sync_input" );if (IS_ERR (i2s->clk_sync_input)) -dev_dbg (dev,"can't retrieve I2S sync input clock\n" ); +return dev_err_probe (dev,PTR_ERR (i2s->clk_sync_input), +"can't retrieve I2S sync input clock\n" ); regs =devm_platform_ioremap_resource (pdev,0 );if (IS_ERR (regs))
Signature · 1 line
2.43.0
Re: [PATCH 4/4] ASoC: tegra: tegra210: Use devm_clk_get_optional() for sync_input clock
Quoted 11 lines · On Wed, Jul 15, 2026 at 12:11:15PM +0700, [email protected] wrote:
From: bui duc phuc <[email protected]>
The existing comment states that the
sync_inputclock is only needed when another I/O is configured to use the current I2S instance as its input clock, and the current code does not treat its absence as an error.
Usedevm_clk_get_optional()to match the existing behaviour while still reporting real failures viadev_err_probe(). Update the comment to describe the optional nature of the clock rather than the previous error handling.
Quoted 4 lines
Signed-off-by bui duc phuc <[email protected]>--- sound/soc/tegra/tegra210_i2s.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
Mark Brown
maintainerQuoted 4 lines · On Wed, 15 Jul 2026 12:11:11 +0700, [email protected] wrote:
ASoC: tegra: Simplify error handling
From: bui duc phuc <[email protected]>
Quoted 8 lines
Hi all,
This series contains a few small cleanups for the Tegra ASoC drivers.
- Usedev_err_probe()for regmap initialization failures.
- Return the original error fromsnd_soc_add_component_controls().
- Usedevm_clk_get_optional()for the optionalsync_inputclock.[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.3
Thanks!
[1/4] ASoC: tegra: tegra20_das: Use dev_err_probe() for error handling
https://git.kernel.org/broonie/sound/c/70d0d7b24d86 [2/4] ASoC: tegra: tegra210_adx: Return the original error directly https://git.kernel.org/broonie/sound/c/b82384bffb27 [3/4] ASoC: tegra: tegra210_amx: Return the original error directly https://git.kernel.org/broonie/sound/c/f7cbc51424cd [4/4] ASoC: tegra: tegra210: Use devm_clk_get_optional() for sync_input clock https://git.kernel.org/broonie/sound/c/226791fa6dbb
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