* [PATCH 1/4] ASoC: tegra: tegra20_das: Use dev_err_probe() for error handling
2026-07-15 5:11 [PATCH 0/4] ASoC: tegra: Simplify error handling phucduc.bui
@ 2026-07-15 5:11 ` phucduc.bui
2026-07-15 5:11 ` [PATCH 2/4] ASoC: tegra: tegra210_adx: Return the original error directly phucduc.bui
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: phucduc.bui @ 2026-07-15 5:11 UTC (permalink / raw)
To: Mark Brown, Thierry Reding, Liam Girdwood, Jaroslav Kysela,
Takashi Iwai, Jonathan Hunter
Cc: Krzysztof Kozlowski, Sheetal, u.kleine-koenig, Kuninori Morimoto,
Rosen Penev, Piyush Patle, Takashi Sakamoto, Bjorn Helgaas,
linux-tegra, linux-kernel, linux-sound, bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
Replace the existing dev_err() and PTR_ERR() sequence with
dev_err_probe(), preserving the original error code while simplifying
the error handling.
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
sound/soc/tegra/tegra20_das.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/sound/soc/tegra/tegra20_das.c b/sound/soc/tegra/tegra20_das.c
index b48cc4a6967b..ea8bc9bcfa67 100644
--- a/sound/soc/tegra/tegra20_das.c
+++ b/sound/soc/tegra/tegra20_das.c
@@ -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);
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 2/4] ASoC: tegra: tegra210_adx: Return the original error directly
2026-07-15 5:11 [PATCH 0/4] ASoC: tegra: Simplify error handling phucduc.bui
2026-07-15 5:11 ` [PATCH 1/4] ASoC: tegra: tegra20_das: Use dev_err_probe() for " phucduc.bui
@ 2026-07-15 5:11 ` phucduc.bui
2026-07-15 5:11 ` [PATCH 3/4] ASoC: tegra: tegra210_amx: " phucduc.bui
2026-07-15 5:11 ` [PATCH 4/4] ASoC: tegra: tegra210: Use devm_clk_get_optional() for sync_input clock phucduc.bui
3 siblings, 0 replies; 5+ messages in thread
From: phucduc.bui @ 2026-07-15 5:11 UTC (permalink / raw)
To: Mark Brown, Thierry Reding, Liam Girdwood, Jaroslav Kysela,
Takashi Iwai, Jonathan Hunter
Cc: Krzysztof Kozlowski, Sheetal, u.kleine-koenig, Kuninori Morimoto,
Rosen Penev, Piyush Patle, Takashi Sakamoto, Bjorn Helgaas,
linux-tegra, linux-kernel, linux-sound, bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
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 <phucduc.bui@gmail.com>
---
sound/soc/tegra/tegra210_adx.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/sound/soc/tegra/tegra210_adx.c b/sound/soc/tegra/tegra210_adx.c
index 15a94196ee1a..e75bf50f8fb0 100644
--- a/sound/soc/tegra/tegra210_adx.c
+++ b/sound/soc/tegra/tegra210_adx.c
@@ -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 = {
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 3/4] ASoC: tegra: tegra210_amx: Return the original error directly
2026-07-15 5:11 [PATCH 0/4] ASoC: tegra: Simplify error handling phucduc.bui
2026-07-15 5:11 ` [PATCH 1/4] ASoC: tegra: tegra20_das: Use dev_err_probe() for " phucduc.bui
2026-07-15 5:11 ` [PATCH 2/4] ASoC: tegra: tegra210_adx: Return the original error directly phucduc.bui
@ 2026-07-15 5:11 ` phucduc.bui
2026-07-15 5:11 ` [PATCH 4/4] ASoC: tegra: tegra210: Use devm_clk_get_optional() for sync_input clock phucduc.bui
3 siblings, 0 replies; 5+ messages in thread
From: phucduc.bui @ 2026-07-15 5:11 UTC (permalink / raw)
To: Mark Brown, Thierry Reding, Liam Girdwood, Jaroslav Kysela,
Takashi Iwai, Jonathan Hunter
Cc: Krzysztof Kozlowski, Sheetal, u.kleine-koenig, Kuninori Morimoto,
Rosen Penev, Piyush Patle, Takashi Sakamoto, Bjorn Helgaas,
linux-tegra, linux-kernel, linux-sound, bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
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 <phucduc.bui@gmail.com>
---
sound/soc/tegra/tegra210_amx.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/sound/soc/tegra/tegra210_amx.c b/sound/soc/tegra/tegra210_amx.c
index cc1f9c158191..6a67ce6128b4 100644
--- a/sound/soc/tegra/tegra210_amx.c
+++ b/sound/soc/tegra/tegra210_amx.c
@@ -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 = {
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 4/4] ASoC: tegra: tegra210: Use devm_clk_get_optional() for sync_input clock
2026-07-15 5:11 [PATCH 0/4] ASoC: tegra: Simplify error handling phucduc.bui
` (2 preceding siblings ...)
2026-07-15 5:11 ` [PATCH 3/4] ASoC: tegra: tegra210_amx: " phucduc.bui
@ 2026-07-15 5:11 ` phucduc.bui
3 siblings, 0 replies; 5+ messages in thread
From: phucduc.bui @ 2026-07-15 5:11 UTC (permalink / raw)
To: Mark Brown, Thierry Reding, Liam Girdwood, Jaroslav Kysela,
Takashi Iwai, Jonathan Hunter
Cc: Krzysztof Kozlowski, Sheetal, u.kleine-koenig, Kuninori Morimoto,
Rosen Penev, Piyush Patle, Takashi Sakamoto, Bjorn Helgaas,
linux-tegra, linux-kernel, linux-sound, bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
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.
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
sound/soc/tegra/tegra210_i2s.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/sound/soc/tegra/tegra210_i2s.c b/sound/soc/tegra/tegra210_i2s.c
index ff8c72fc38c5..e7e26e917291 100644
--- a/sound/soc/tegra/tegra210_i2s.c
+++ b/sound/soc/tegra/tegra210_i2s.c
@@ -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))
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread