[PATCH v2] ASoC: ops: Log unknown controls in snd_soc_limit_volume()
From: Mark Brown
Date: Wed Apr 22 2026 - 16:46:58 EST
When we fail to look up the control name in snd_soc_limit_volume() we don't
log anything, the error code isn't particularly descriptive and checking
the return value of the function at all is a bit erratic among the callers.
Since there is no reason why anyone should ever be attempting to limit the
volume of a nonexistant control add a log message in the core to improve
usability.
Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>
---
Changes in v2:
- Lower the print to a dev_dbg() since some cards do blindly add limits
for multiple variants they handle so would see warnings.
- Link to v1: https://patch.msgid.link/20260421-asoc-limit-volume-error-v1-1-dcd0102576a6@xxxxxxxxxx
---
sound/soc/soc-ops.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/sound/soc/soc-ops.c b/sound/soc/soc-ops.c
index f966d4e13c7f..1fc87cd5ea2f 100644
--- a/sound/soc/soc-ops.c
+++ b/sound/soc/soc-ops.c
@@ -503,6 +503,10 @@ int snd_soc_limit_volume(struct snd_soc_card *card, const char *name, int max)
mc->platform_max = max;
ret = snd_soc_clip_to_platform_max(kctl);
}
+ } else {
+ /* Some cards blindly add limits for multiple variants. */
+ dev_dbg(card->dev, "Volume limit for unknown control '%s'\n",
+ name);
}
return ret;
---
base-commit: 028ef9c96e96197026887c0f092424679298aae8
change-id: 20260421-asoc-limit-volume-error-ca28188dc7c9
Best regards,
--
Mark Brown <broonie@xxxxxxxxxx>