* [PATCH v2] ASoC: tegra: Add error logging for probe and callback failures
@ 2026-03-23 10:12 Sheetal
2026-03-23 21:41 ` Mark Brown
2026-03-23 21:43 ` Mark Brown
0 siblings, 2 replies; 3+ messages in thread
From: Sheetal @ 2026-03-23 10:12 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Thierry Reding, Jonathan Hunter
Cc: Jaroslav Kysela, Takashi Iwai, Mohan Kumar, Kuninori Morimoto,
linux-sound, linux-tegra, linux-kernel, Sheetal
Add error logging across probe and runtime error paths in Tegra audio
drivers to improve debuggability. Use dev_err_probe() in all probe
error paths as a defensive measure against future API changes that
may return -EPROBE_DEFER. Use dev_err() for runtime callback paths.
Skip redundant logging where the underlying API already reports errors.
Signed-off-by: Sheetal <sheetal@nvidia.com>
---
Changes in v2:
- Use dev_err_probe() in all probe error paths as a defensive measure,
instead of only where -EPROBE_DEFER is currently known to be returned.
- Drop redundant error logging for devm_platform_ioremap_resource() and
devm_ioremap_resource() since these APIs already log errors internally.
sound/soc/tegra/tegra186_asrc.c | 7 ++---
sound/soc/tegra/tegra186_dspk.c | 15 +++------
sound/soc/tegra/tegra210_admaif.c | 18 +++++++----
sound/soc/tegra/tegra210_adx.c | 13 ++++---
sound/soc/tegra/tegra210_ahub.c | 23 +++++++------
sound/soc/tegra/tegra210_amx.c | 9 +++--
sound/soc/tegra/tegra210_dmic.c | 14 +++-----
sound/soc/tegra/tegra210_i2s.c | 18 +++++-----
sound/soc/tegra/tegra210_mbdrc.c | 12 ++++---
sound/soc/tegra/tegra210_mixer.c | 10 ++++--
sound/soc/tegra/tegra210_mvc.c | 7 ++---
sound/soc/tegra/tegra210_ope.c | 19 +++-------
sound/soc/tegra/tegra210_peq.c | 12 ++++---
sound/soc/tegra/tegra210_sfc.c | 7 ++---
sound/soc/tegra/tegra_asoc_machine.c | 70 ++++++++++++++++++--------------
sound/soc/tegra/tegra_audio_graph_card.c | 21 ++++------
16 files changed, 137 insertions(+), 138 deletions(-)
diff --git a/sound/soc/tegra/tegra186_asrc.c b/sound/soc/tegra/tegra186_asrc.c
index d2a5ec7c54cc..98e911e2ed74 100644
--- a/sound/soc/tegra/tegra186_asrc.c
+++ b/sound/soc/tegra/tegra186_asrc.c
@@ -1016,10 +1016,9 @@ static int tegra186_asrc_platform_probe(struct platform_device *pdev)
err = devm_snd_soc_register_component(dev, &tegra186_asrc_cmpnt,
tegra186_asrc_dais,
ARRAY_SIZE(tegra186_asrc_dais));
- if (err) {
- dev_err(dev, "can't register ASRC component, err: %d\n", err);
- return err;
- }
+ if (err)
+ return dev_err_probe(dev, err,
+ "can't register ASRC component\n");
pm_runtime_enable(dev);
diff --git a/sound/soc/tegra/tegra186_dspk.c b/sound/soc/tegra/tegra186_dspk.c
index 8816e4967331..1aa94c98294a 100644
--- a/sound/soc/tegra/tegra186_dspk.c
+++ b/sound/soc/tegra/tegra186_dspk.c
@@ -496,10 +496,9 @@ static int tegra186_dspk_platform_probe(struct platform_device *pdev)
dev_set_drvdata(dev, dspk);
dspk->clk_dspk = devm_clk_get(dev, "dspk");
- if (IS_ERR(dspk->clk_dspk)) {
- dev_err(dev, "can't retrieve DSPK clock\n");
- return PTR_ERR(dspk->clk_dspk);
- }
+ if (IS_ERR(dspk->clk_dspk))
+ return dev_err_probe(dev, PTR_ERR(dspk->clk_dspk),
+ "can't retrieve DSPK clock\n");
regs = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(regs))
@@ -516,11 +515,9 @@ static int tegra186_dspk_platform_probe(struct platform_device *pdev)
err = devm_snd_soc_register_component(dev, &tegra186_dspk_cmpnt,
tegra186_dspk_dais,
ARRAY_SIZE(tegra186_dspk_dais));
- if (err) {
- dev_err(dev, "can't register DSPK component, err: %d\n",
- err);
- return err;
- }
+ if (err)
+ return dev_err_probe(dev, err,
+ "can't register DSPK component\n");
pm_runtime_enable(dev);
diff --git a/sound/soc/tegra/tegra210_admaif.c b/sound/soc/tegra/tegra210_admaif.c
index 0976779d29f2..5d690a2f8509 100644
--- a/sound/soc/tegra/tegra210_admaif.c
+++ b/sound/soc/tegra/tegra210_admaif.c
@@ -408,6 +408,7 @@ static int tegra_admaif_start(struct snd_soc_dai *dai, int direction)
reg = CH_RX_REG(TEGRA_ADMAIF_RX_ENABLE, dai->id);
break;
default:
+ dev_err(dai->dev, "invalid stream direction: %d\n", direction);
return -EINVAL;
}
@@ -441,6 +442,7 @@ static int tegra_admaif_stop(struct snd_soc_dai *dai, int direction)
reset_reg = CH_RX_REG(TEGRA_ADMAIF_RX_SOFT_RESET, dai->id);
break;
default:
+ dev_err(dai->dev, "invalid stream direction: %d\n", direction);
return -EINVAL;
}
@@ -489,6 +491,7 @@ static int tegra_admaif_trigger(struct snd_pcm_substream *substream, int cmd,
case SNDRV_PCM_TRIGGER_SUSPEND:
return tegra_admaif_stop(dai, substream->stream);
default:
+ dev_err(dai->dev, "invalid trigger command: %d\n", cmd);
return -EINVAL;
}
}
@@ -966,10 +969,9 @@ static int tegra_admaif_probe(struct platform_device *pdev)
regcache_cache_only(admaif->regmap, true);
err = tegra_isomgr_adma_register(&pdev->dev);
- if (err) {
- dev_err(&pdev->dev, "Failed to add interconnect path\n");
- return err;
- }
+ if (err)
+ return dev_err_probe(&pdev->dev, err,
+ "failed to add interconnect path\n");
regmap_update_bits(admaif->regmap, admaif->soc_data->global_base +
TEGRA_ADMAIF_GLOBAL_ENABLE, 1, 1);
@@ -1009,11 +1011,9 @@ static int tegra_admaif_probe(struct platform_device *pdev)
admaif->soc_data->cmpnt,
admaif->soc_data->dais,
admaif->soc_data->num_ch);
- if (err) {
- dev_err(&pdev->dev,
- "can't register ADMAIF component, err: %d\n", err);
- return err;
- }
+ if (err)
+ return dev_err_probe(&pdev->dev, err,
+ "can't register ADMAIF component\n");
pm_runtime_enable(&pdev->dev);
diff --git a/sound/soc/tegra/tegra210_adx.c b/sound/soc/tegra/tegra210_adx.c
index 95875c75ddf8..d7d075fd54b2 100644
--- a/sound/soc/tegra/tegra210_adx.c
+++ b/sound/soc/tegra/tegra210_adx.c
@@ -134,8 +134,11 @@ static int tegra210_adx_set_audio_cif(struct snd_soc_dai *dai,
memset(&cif_conf, 0, sizeof(struct tegra_cif_conf));
- if (channels < 1 || channels > adx->soc_data->max_ch)
+ if (channels < 1 || channels > adx->soc_data->max_ch) {
+ dev_err(dai->dev, "invalid channels: %u (max %u)\n",
+ channels, adx->soc_data->max_ch);
return -EINVAL;
+ }
switch (format) {
case SNDRV_PCM_FORMAT_S8:
@@ -149,6 +152,7 @@ static int tegra210_adx_set_audio_cif(struct snd_soc_dai *dai,
audio_bits = TEGRA_ACIF_BITS_32;
break;
default:
+ dev_err(dai->dev, "unsupported format: %d\n", format);
return -EINVAL;
}
@@ -717,10 +721,9 @@ static int tegra210_adx_platform_probe(struct platform_device *pdev)
err = devm_snd_soc_register_component(dev, &tegra210_adx_cmpnt,
tegra210_adx_dais,
ARRAY_SIZE(tegra210_adx_dais));
- if (err) {
- dev_err(dev, "can't register ADX component, err: %d\n", err);
- return err;
- }
+ if (err)
+ return dev_err_probe(dev, err,
+ "can't register ADX component\n");
pm_runtime_enable(dev);
diff --git a/sound/soc/tegra/tegra210_ahub.c b/sound/soc/tegra/tegra210_ahub.c
index 43a45f785d5b..4626dd0a4d55 100644
--- a/sound/soc/tegra/tegra210_ahub.c
+++ b/sound/soc/tegra/tegra210_ahub.c
@@ -64,8 +64,11 @@ static int tegra_ahub_put_value_enum(struct snd_kcontrol *kctl,
unsigned int i, bit_pos, reg_idx = 0, reg_val = 0;
int change = 0;
- if (item[0] >= e->items)
+ if (item[0] >= e->items) {
+ dev_err(cmpnt->dev, "invalid MUX item: %u >= %u\n",
+ item[0], e->items);
return -EINVAL;
+ }
if (value) {
/* Get the register index and value to set */
@@ -2265,10 +2268,9 @@ static int tegra_ahub_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, ahub);
ahub->clk = devm_clk_get(&pdev->dev, "ahub");
- if (IS_ERR(ahub->clk)) {
- dev_err(&pdev->dev, "can't retrieve AHUB clock\n");
- return PTR_ERR(ahub->clk);
- }
+ if (IS_ERR(ahub->clk))
+ return dev_err_probe(&pdev->dev, PTR_ERR(ahub->clk),
+ "can't retrieve AHUB clock\n");
regs = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(regs))
@@ -2287,16 +2289,15 @@ static int tegra_ahub_probe(struct platform_device *pdev)
ahub->soc_data->cmpnt_drv,
ahub->soc_data->dai_drv,
ahub->soc_data->num_dais);
- if (err) {
- dev_err(&pdev->dev, "can't register AHUB component, err: %d\n",
- err);
- return err;
- }
+ if (err)
+ return dev_err_probe(&pdev->dev, err,
+ "can't register AHUB component\n");
pm_runtime_enable(&pdev->dev);
err = of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev);
if (err) {
pm_runtime_disable(&pdev->dev);
- return err;
+ return dev_err_probe(&pdev->dev, err,
+ "failed to populate child nodes\n");
}
diff --git a/sound/soc/tegra/tegra210_amx.c b/sound/soc/tegra/tegra210_amx.c
index bfda82505298..1b7fb84a0f34 100644
--- a/sound/soc/tegra/tegra210_amx.c
+++ b/sound/soc/tegra/tegra210_amx.c
@@ -163,6 +163,8 @@ static int tegra210_amx_set_audio_cif(struct snd_soc_dai *dai,
audio_bits = TEGRA_ACIF_BITS_32;
break;
default:
+ dev_err(dai->dev, "unsupported format: %d\n",
+ params_format(params));
return -EINVAL;
}
@@ -767,10 +769,9 @@ static int tegra210_amx_platform_probe(struct platform_device *pdev)
err = devm_snd_soc_register_component(dev, &tegra210_amx_cmpnt,
tegra210_amx_dais,
ARRAY_SIZE(tegra210_amx_dais));
- if (err) {
- dev_err(dev, "can't register AMX component, err: %d\n", err);
- return err;
- }
+ if (err)
+ return dev_err_probe(dev, err,
+ "can't register AMX component\n");
pm_runtime_enable(dev);
diff --git a/sound/soc/tegra/tegra210_dmic.c b/sound/soc/tegra/tegra210_dmic.c
index 93def7ac4fde..5a4bd5cef30a 100644
--- a/sound/soc/tegra/tegra210_dmic.c
+++ b/sound/soc/tegra/tegra210_dmic.c
@@ -507,10 +507,9 @@ static int tegra210_dmic_probe(struct platform_device *pdev)
dev_set_drvdata(dev, dmic);
dmic->clk_dmic = devm_clk_get(dev, "dmic");
- if (IS_ERR(dmic->clk_dmic)) {
- dev_err(dev, "can't retrieve DMIC clock\n");
- return PTR_ERR(dmic->clk_dmic);
- }
+ if (IS_ERR(dmic->clk_dmic))
+ return dev_err_probe(dev, PTR_ERR(dmic->clk_dmic),
+ "can't retrieve DMIC clock\n");
regs = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(regs))
@@ -528,10 +527,9 @@ static int tegra210_dmic_probe(struct platform_device *pdev)
err = devm_snd_soc_register_component(dev, &tegra210_dmic_compnt,
tegra210_dmic_dais,
ARRAY_SIZE(tegra210_dmic_dais));
- if (err) {
- dev_err(dev, "can't register DMIC component, err: %d\n", err);
- return err;
- }
+ if (err)
+ return dev_err_probe(dev, err,
+ "can't register DMIC component\n");
pm_runtime_enable(dev);
diff --git a/sound/soc/tegra/tegra210_i2s.c b/sound/soc/tegra/tegra210_i2s.c
index d8e02f0a3025..7bf76c9b640f 100644
--- a/sound/soc/tegra/tegra210_i2s.c
+++ b/sound/soc/tegra/tegra210_i2s.c
@@ -161,6 +161,7 @@ static int tegra210_i2s_init(struct snd_soc_dapm_widget *w,
stream = SNDRV_PCM_STREAM_CAPTURE;
status_reg = TEGRA210_I2S_TX_STATUS + i2s->soc_data->tx_offset;
} else {
+ dev_err(dev, "invalid I2S direction register 0x%x\n", w->reg);
return -EINVAL;
}
@@ -235,6 +236,7 @@ static int tegra210_i2s_set_fmt(struct snd_soc_dai *dai,
val = I2S_CTRL_MASTER_EN;
break;
default:
+ dev_err(dai->dev, "invalid clock provider format 0x%x\n", fmt);
return -EINVAL;
}
@@ -270,6 +272,7 @@ static int tegra210_i2s_set_fmt(struct snd_soc_dai *dai,
tegra210_i2s_set_data_offset(i2s, 0);
break;
default:
+ dev_err(dai->dev, "invalid I2S frame format 0x%x\n", fmt);
return -EINVAL;
}
@@ -290,6 +293,7 @@ static int tegra210_i2s_set_fmt(struct snd_soc_dai *dai,
val ^= I2S_CTRL_LRCK_POL_MASK;
break;
default:
+ dev_err(dai->dev, "invalid I2S clock inversion 0x%x\n", fmt);
return -EINVAL;
}
@@ -1070,10 +1074,9 @@ static int tegra210_i2s_probe(struct platform_device *pdev)
dev_set_drvdata(dev, i2s);
i2s->clk_i2s = devm_clk_get(dev, "i2s");
- if (IS_ERR(i2s->clk_i2s)) {
- dev_err(dev, "can't retrieve I2S bit clock\n");
- return PTR_ERR(i2s->clk_i2s);
- }
+ if (IS_ERR(i2s->clk_i2s))
+ return dev_err_probe(dev, PTR_ERR(i2s->clk_i2s),
+ "can't retrieve I2S bit clock\n");
/*
* Not an error, as this clock is needed only when some other I/O
@@ -1108,10 +1111,9 @@ static int tegra210_i2s_probe(struct platform_device *pdev)
err = devm_snd_soc_register_component(dev, i2s->soc_data->i2s_cmpnt,
tegra210_i2s_dais,
ARRAY_SIZE(tegra210_i2s_dais));
- if (err) {
- dev_err(dev, "can't register I2S component, err: %d\n", err);
- return err;
- }
+ if (err)
+ return dev_err_probe(dev, err,
+ "can't register I2S component\n");
pm_runtime_enable(dev);
diff --git a/sound/soc/tegra/tegra210_mbdrc.c b/sound/soc/tegra/tegra210_mbdrc.c
index 6a268dbb7197..558b7a21b0be 100644
--- a/sound/soc/tegra/tegra210_mbdrc.c
+++ b/sound/soc/tegra/tegra210_mbdrc.c
@@ -987,8 +987,9 @@ int tegra210_mbdrc_regmap_init(struct platform_device *pdev)
int err;
child = of_get_child_by_name(dev->of_node, "dynamic-range-compressor");
if (!child)
- return -ENODEV;
+ return dev_err_probe(dev, -ENODEV,
+ "missing 'dynamic-range-compressor' DT child node\n");
err = of_address_to_resource(child, 0, &mem);
of_node_put(child);
@@ -1004,7 +1005,6 @@ int tegra210_mbdrc_regmap_init(struct platform_device *pdev)
ope->mbdrc_regmap = devm_regmap_init_mmio(dev, regs,
&tegra210_mbdrc_regmap_cfg);
- if (IS_ERR(ope->mbdrc_regmap)) {
- dev_err(dev, "regmap init failed\n");
- return PTR_ERR(ope->mbdrc_regmap);
- }
+ if (IS_ERR(ope->mbdrc_regmap))
+ return dev_err_probe(dev, PTR_ERR(ope->mbdrc_regmap),
+ "MBDRC regmap init failed\n");
diff --git a/sound/soc/tegra/tegra210_mixer.c b/sound/soc/tegra/tegra210_mixer.c
index 6d3a2b76fd61..d9318aaaf32e 100644
--- a/sound/soc/tegra/tegra210_mixer.c
+++ b/sound/soc/tegra/tegra210_mixer.c
@@ -253,6 +253,9 @@ static int tegra210_mixer_set_audio_cif(struct tegra210_mixer *mixer,
audio_bits = TEGRA_ACIF_BITS_32;
break;
default:
+ dev_err(regmap_get_device(mixer->regmap),
+ "unsupported format for MIXER CIF: %d\n",
+ params_format(params));
return -EINVAL;
}
@@ -651,10 +654,9 @@ static int tegra210_mixer_platform_probe(struct platform_device *pdev)
err = devm_snd_soc_register_component(dev, &tegra210_mixer_cmpnt,
tegra210_mixer_dais,
ARRAY_SIZE(tegra210_mixer_dais));
- if (err) {
- dev_err(dev, "can't register MIXER component, err: %d\n", err);
- return err;
- }
+ if (err)
+ return dev_err_probe(dev, err,
+ "can't register MIXER component\n");
pm_runtime_enable(dev);
diff --git a/sound/soc/tegra/tegra210_mvc.c b/sound/soc/tegra/tegra210_mvc.c
index 6cdc5e1f5507..11bd0ea22797 100644
--- a/sound/soc/tegra/tegra210_mvc.c
+++ b/sound/soc/tegra/tegra210_mvc.c
@@ -741,10 +741,9 @@ static int tegra210_mvc_platform_probe(struct platform_device *pdev)
err = devm_snd_soc_register_component(dev, &tegra210_mvc_cmpnt,
tegra210_mvc_dais,
ARRAY_SIZE(tegra210_mvc_dais));
- if (err) {
- dev_err(dev, "can't register MVC component, err: %d\n", err);
- return err;
- }
+ if (err)
+ return dev_err_probe(dev, err,
+ "can't register MVC component\n");
pm_runtime_enable(dev);
diff --git a/sound/soc/tegra/tegra210_ope.c b/sound/soc/tegra/tegra210_ope.c
index a440888dcdbd..e311de41a078 100644
--- a/sound/soc/tegra/tegra210_ope.c
+++ b/sound/soc/tegra/tegra210_ope.c
@@ -329,23 +329,18 @@ static int tegra210_ope_probe(struct platform_device *pdev)
err = tegra210_peq_regmap_init(pdev);
- if (err < 0) {
- dev_err(dev, "PEQ init failed\n");
- return err;
- }
+ if (err < 0)
+ return dev_err_probe(dev, err, "PEQ init failed\n");
err = tegra210_mbdrc_regmap_init(pdev);
- if (err < 0) {
- dev_err(dev, "MBDRC init failed\n");
- return err;
- }
+ if (err < 0)
+ return dev_err_probe(dev, err, "MBDRC init failed\n");
err = devm_snd_soc_register_component(dev, &tegra210_ope_cmpnt,
tegra210_ope_dais,
ARRAY_SIZE(tegra210_ope_dais));
- if (err) {
- dev_err(dev, "can't register OPE component, err: %d\n", err);
- return err;
- }
+ if (err)
+ return dev_err_probe(dev, err,
+ "can't register OPE component\n");
pm_runtime_enable(dev);
diff --git a/sound/soc/tegra/tegra210_peq.c b/sound/soc/tegra/tegra210_peq.c
index 2f72e9d541dc..4b692c2055bc 100644
--- a/sound/soc/tegra/tegra210_peq.c
+++ b/sound/soc/tegra/tegra210_peq.c
@@ -407,8 +407,9 @@ int tegra210_peq_regmap_init(struct platform_device *pdev)
int err;
child = of_get_child_by_name(dev->of_node, "equalizer");
if (!child)
- return -ENODEV;
+ return dev_err_probe(dev, -ENODEV,
+ "missing 'equalizer' DT child node\n");
err = of_address_to_resource(child, 0, &mem);
of_node_put(child);
@@ -424,7 +425,6 @@ int tegra210_peq_regmap_init(struct platform_device *pdev)
ope->peq_regmap = devm_regmap_init_mmio(dev, regs,
&tegra210_peq_regmap_config);
- if (IS_ERR(ope->peq_regmap)) {
- dev_err(dev, "regmap init failed\n");
- return PTR_ERR(ope->peq_regmap);
- }
+ if (IS_ERR(ope->peq_regmap))
+ return dev_err_probe(dev, PTR_ERR(ope->peq_regmap),
+ "PEQ regmap init failed\n");
diff --git a/sound/soc/tegra/tegra210_sfc.c b/sound/soc/tegra/tegra210_sfc.c
index b298bf0421b1..0f342fae058f 100644
--- a/sound/soc/tegra/tegra210_sfc.c
+++ b/sound/soc/tegra/tegra210_sfc.c
@@ -3608,10 +3608,9 @@ static int tegra210_sfc_platform_probe(struct platform_device *pdev)
err = devm_snd_soc_register_component(dev, &tegra210_sfc_cmpnt,
tegra210_sfc_dais,
ARRAY_SIZE(tegra210_sfc_dais));
- if (err) {
- dev_err(dev, "can't register SFC component, err: %d\n", err);
- return err;
- }
+ if (err)
+ return dev_err_probe(dev, err,
+ "can't register SFC component\n");
pm_runtime_enable(&pdev->dev);
diff --git a/sound/soc/tegra/tegra_asoc_machine.c b/sound/soc/tegra/tegra_asoc_machine.c
index 10834f9c3422..d7245a10bba1 100644
--- a/sound/soc/tegra/tegra_asoc_machine.c
+++ b/sound/soc/tegra/tegra_asoc_machine.c
@@ -431,8 +431,9 @@ static int tegra_machine_register_codec(struct device *dev, const char *name)
return 0;
pdev = platform_device_register_simple(name, -1, NULL, 0);
if (IS_ERR(pdev))
- return PTR_ERR(pdev);
+ return dev_err_probe(dev, PTR_ERR(pdev),
+ "failed to register codec %s\n", name);
err = devm_add_action_or_reset(dev, tegra_machine_unregister_codec,
pdev);
@@ -468,32 +469,38 @@ int tegra_asoc_machine_probe(struct platform_device *pdev)
gpiod = devm_gpiod_get_optional(dev, "nvidia,hp-mute", GPIOD_OUT_HIGH);
machine->gpiod_hp_mute = gpiod;
if (IS_ERR(gpiod))
- return PTR_ERR(gpiod);
+ return dev_err_probe(dev, PTR_ERR(gpiod),
+ "failed to get hp-mute GPIO\n");
gpiod = devm_gpiod_get_optional(dev, "nvidia,hp-det", GPIOD_IN);
machine->gpiod_hp_det = gpiod;
if (IS_ERR(gpiod))
- return PTR_ERR(gpiod);
+ return dev_err_probe(dev, PTR_ERR(gpiod),
+ "failed to get hp-det GPIO\n");
gpiod = devm_gpiod_get_optional(dev, "nvidia,mic-det", GPIOD_IN);
machine->gpiod_mic_det = gpiod;
if (IS_ERR(gpiod))
- return PTR_ERR(gpiod);
+ return dev_err_probe(dev, PTR_ERR(gpiod),
+ "failed to get mic-det GPIO\n");
gpiod = devm_gpiod_get_optional(dev, "nvidia,spkr-en", GPIOD_OUT_LOW);
machine->gpiod_spkr_en = gpiod;
if (IS_ERR(gpiod))
- return PTR_ERR(gpiod);
+ return dev_err_probe(dev, PTR_ERR(gpiod),
+ "failed to get spkr-en GPIO\n");
gpiod = devm_gpiod_get_optional(dev, "nvidia,int-mic-en", GPIOD_OUT_LOW);
machine->gpiod_int_mic_en = gpiod;
if (IS_ERR(gpiod))
- return PTR_ERR(gpiod);
+ return dev_err_probe(dev, PTR_ERR(gpiod),
+ "failed to get int-mic-en GPIO\n");
gpiod = devm_gpiod_get_optional(dev, "nvidia,ext-mic-en", GPIOD_OUT_LOW);
machine->gpiod_ext_mic_en = gpiod;
if (IS_ERR(gpiod))
- return PTR_ERR(gpiod);
+ return dev_err_probe(dev, PTR_ERR(gpiod),
+ "failed to get ext-mic-en GPIO\n");
err = snd_soc_of_parse_card_name(card, "nvidia,model");
if (err)
@@ -549,22 +556,19 @@ int tegra_asoc_machine_probe(struct platform_device *pdev)
card->driver_name = "tegra";
machine->clk_pll_a = devm_clk_get(dev, "pll_a");
- if (IS_ERR(machine->clk_pll_a)) {
- dev_err(dev, "Can't retrieve clk pll_a\n");
- return PTR_ERR(machine->clk_pll_a);
- }
+ if (IS_ERR(machine->clk_pll_a))
+ return dev_err_probe(dev, PTR_ERR(machine->clk_pll_a),
+ "can't retrieve clk pll_a\n");
machine->clk_pll_a_out0 = devm_clk_get(dev, "pll_a_out0");
- if (IS_ERR(machine->clk_pll_a_out0)) {
- dev_err(dev, "Can't retrieve clk pll_a_out0\n");
- return PTR_ERR(machine->clk_pll_a_out0);
- }
+ if (IS_ERR(machine->clk_pll_a_out0))
+ return dev_err_probe(dev, PTR_ERR(machine->clk_pll_a_out0),
+ "can't retrieve clk pll_a_out0\n");
machine->clk_cdev1 = devm_clk_get(dev, "mclk");
- if (IS_ERR(machine->clk_cdev1)) {
- dev_err(dev, "Can't retrieve clk cdev1\n");
- return PTR_ERR(machine->clk_cdev1);
- }
+ if (IS_ERR(machine->clk_cdev1))
+ return dev_err_probe(dev, PTR_ERR(machine->clk_cdev1),
+ "can't retrieve clk cdev1\n");
/*
* If clock parents are not set in DT, configure here to use clk_out_1
@@ -578,26 +582,22 @@ int tegra_asoc_machine_probe(struct platform_device *pdev)
dev_warn(dev, "Please update DT to use assigned-clock-parents\n");
clk_extern1 = devm_clk_get(dev, "extern1");
- if (IS_ERR(clk_extern1)) {
- dev_err(dev, "Can't retrieve clk extern1\n");
- return PTR_ERR(clk_extern1);
- }
+ if (IS_ERR(clk_extern1))
+ return dev_err_probe(dev, PTR_ERR(clk_extern1),
+ "can't retrieve clk extern1\n");
err = clk_set_parent(clk_extern1, machine->clk_pll_a_out0);
- if (err < 0) {
- dev_err(dev, "Set parent failed for clk extern1\n");
- return err;
- }
+ if (err < 0)
+ return dev_err_probe(dev, err,
+ "set parent failed for clk extern1\n");
clk_out_1 = devm_clk_get(dev, "pmc_clk_out_1");
- if (IS_ERR(clk_out_1)) {
- dev_err(dev, "Can't retrieve pmc_clk_out_1\n");
- return PTR_ERR(clk_out_1);
- }
+ if (IS_ERR(clk_out_1))
+ return dev_err_probe(dev, PTR_ERR(clk_out_1),
+ "can't retrieve pmc_clk_out_1\n");
err = clk_set_parent(clk_out_1, clk_extern1);
- if (err < 0) {
- dev_err(dev, "Set parent failed for pmc_clk_out_1\n");
- return err;
- }
+ if (err < 0)
+ return dev_err_probe(dev, err,
+ "set parent failed for pmc_clk_out_1\n");
diff --git a/sound/soc/tegra/tegra_audio_graph_card.c b/sound/soc/tegra/tegra_audio_graph_card.c
index ea10e6e8a9fe..b93a61db9ed0 100644
--- a/sound/soc/tegra/tegra_audio_graph_card.c
+++ b/sound/soc/tegra/tegra_audio_graph_card.c
@@ -174,20 +174,23 @@ static int tegra_audio_graph_card_probe(struct snd_soc_card *card)
{
struct simple_util_priv *simple = snd_soc_card_get_drvdata(card);
struct tegra_audio_priv *priv = simple_to_tegra_priv(simple);
+ int ret;
priv->clk_plla = devm_clk_get(card->dev, "pll_a");
- if (IS_ERR(priv->clk_plla)) {
- dev_err(card->dev, "Can't retrieve clk pll_a\n");
- return PTR_ERR(priv->clk_plla);
- }
+ if (IS_ERR(priv->clk_plla))
+ return dev_err_probe(card->dev, PTR_ERR(priv->clk_plla),
+ "can't retrieve clk pll_a\n");
priv->clk_plla_out0 = devm_clk_get(card->dev, "plla_out0");
- if (IS_ERR(priv->clk_plla_out0)) {
- dev_err(card->dev, "Can't retrieve clk plla_out0\n");
- return PTR_ERR(priv->clk_plla_out0);
- }
+ if (IS_ERR(priv->clk_plla_out0))
+ return dev_err_probe(card->dev, PTR_ERR(priv->clk_plla_out0),
+ "can't retrieve clk plla_out0\n");
+
+ ret = graph_util_card_probe(card);
+ if (ret < 0)
+ return dev_err_probe(card->dev, ret, "graph_util_card_probe failed\n");
- return graph_util_card_probe(card);
+ return ret;
}
static int tegra_audio_graph_probe(struct platform_device *pdev)
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] ASoC: tegra: Add error logging for probe and callback failures
2026-03-23 10:12 [PATCH v2] ASoC: tegra: Add error logging for probe and callback failures Sheetal
@ 2026-03-23 21:41 ` Mark Brown
2026-03-23 21:43 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2026-03-23 21:41 UTC (permalink / raw)
To: Sheetal
Cc: Liam Girdwood, Thierry Reding, Jonathan Hunter, Jaroslav Kysela,
Takashi Iwai, Mohan Kumar, Kuninori Morimoto, linux-sound,
linux-tegra, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1736 bytes --]
On Mon, Mar 23, 2026 at 10:12:42AM +0000, Sheetal wrote:
> Add error logging across probe and runtime error paths in Tegra audio
> drivers to improve debuggability. Use dev_err_probe() in all probe
> error paths as a defensive measure against future API changes that
> may return -EPROBE_DEFER. Use dev_err() for runtime callback paths.
> Skip redundant logging where the underlying API already reports errors.
> diff --git a/sound/soc/tegra/tegra210_ahub.c b/sound/soc/tegra/tegra210_ahub.c
> index 43a45f785d5b..4626dd0a4d55 100644
> --- a/sound/soc/tegra/tegra210_ahub.c
> +++ b/sound/soc/tegra/tegra210_ahub.c
> @@ -64,8 +64,11 @@ static int tegra_ahub_put_value_enum(struct snd_kcontrol *kctl,
> unsigned int i, bit_pos, reg_idx = 0, reg_val = 0;
> int change = 0;
>
> - if (item[0] >= e->items)
> + if (item[0] >= e->items) {
> + dev_err(cmpnt->dev, "invalid MUX item: %u >= %u\n",
> + item[0], e->items);
> return -EINVAL;
> + }
>
This one can be triggered directly from userspace so it's better to be
slient, otherwise people can spam the logs.
> index 6d3a2b76fd61..d9318aaaf32e 100644
> --- a/sound/soc/tegra/tegra210_mixer.c
> +++ b/sound/soc/tegra/tegra210_mixer.c
> @@ -253,6 +253,9 @@ static int tegra210_mixer_set_audio_cif(struct tegra210_mixer *mixer,
> audio_bits = TEGRA_ACIF_BITS_32;
> break;
> default:
> + dev_err(regmap_get_device(mixer->regmap),
> + "unsupported format for MIXER CIF: %d\n",
> + params_format(params));
> return -EINVAL;
> }
Not your bug but the driver claims to support _S8 format and this
function doesn't actually implement it so we end up with another path
where userspace can spam dev_err() as a result of this.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] ASoC: tegra: Add error logging for probe and callback failures
2026-03-23 10:12 [PATCH v2] ASoC: tegra: Add error logging for probe and callback failures Sheetal
2026-03-23 21:41 ` Mark Brown
@ 2026-03-23 21:43 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2026-03-23 21:43 UTC (permalink / raw)
To: Sheetal
Cc: Liam Girdwood, Thierry Reding, Jonathan Hunter, Jaroslav Kysela,
Takashi Iwai, Mohan Kumar, Kuninori Morimoto, linux-sound,
linux-tegra, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 604 bytes --]
On Mon, Mar 23, 2026 at 10:12:42AM +0000, Sheetal wrote:
> Add error logging across probe and runtime error paths in Tegra audio
> drivers to improve debuggability. Use dev_err_probe() in all probe
> error paths as a defensive measure against future API changes that
> may return -EPROBE_DEFER. Use dev_err() for runtime callback paths.
> Skip redundant logging where the underlying API already reports errors.
BTW, can I suggest splitting this up per driver or something - the
change is 99% good, if it were split up then most of it could get merged
even if there's one or two odd bits need some work.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-03-23 21:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-23 10:12 [PATCH v2] ASoC: tegra: Add error logging for probe and callback failures Sheetal
2026-03-23 21:41 ` Mark Brown
2026-03-23 21:43 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox