mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] ASoC: sdw_utils: Remove dead code in asoc_sdw_ti_add_tac5xx2_routes()
@ 2026-05-13  1:55 Niranjan H Y
  2026-05-14  0:51 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Niranjan H Y @ 2026-05-13  1:55 UTC (permalink / raw)
  To: linux-sound
  Cc: linux-kernel, broonie, ckeepax, lgirdwood, perex, tiwai,
	cezary.rojewski, peter.ujfalusi, yung-chuan.liao, kai.vehmanen,
	pierre-louis.bossart, baojun.xu, shenghao-ding, sandeepk,
	v-hampiholi, Niranjan H Y, Dan Carpenter

Remove unnecessary checks for scnprintf() return values in
asoc_sdw_ti_add_tac5xx2_routes(). The function scnprintf() never
returns negative values and cannot return zero given the format
strings used ("%s SPK_L" and "%s SPK_R").

The existing length validation at line 110 already ensures that
name_prefix won't cause buffer overflow, and scnprintf() guarantees
null-termination even in case of truncation.

Fixes: e812de61e9a0 ("ASoC: sdw_utils: TI amp utility for tac5xx2 family")
Reported-by: Dan Carpenter <error27@gmail.com>
Closes: https://lore.kernel.org/linux-sound/agF8GBcHYUaGJbXY@stanley.mountain/
Signed-off-by: Niranjan H Y <niranjan.hy@ti.com>
---
Changes in v2:
- update Reported-by with correct email id.
---
 sound/soc/sdw_utils/soc_sdw_ti_amp.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/sound/soc/sdw_utils/soc_sdw_ti_amp.c b/sound/soc/sdw_utils/soc_sdw_ti_amp.c
index f156116fbeb..d0ae5d7efe8 100644
--- a/sound/soc/sdw_utils/soc_sdw_ti_amp.c
+++ b/sound/soc/sdw_utils/soc_sdw_ti_amp.c
@@ -105,18 +105,12 @@ static int asoc_sdw_ti_add_tac5xx2_routes(struct snd_soc_dapm_context *dapm,
 	struct snd_soc_dapm_route routes[2];
 	char left_widget[TAC5XX2_WIDGET_NAME_MAX];
 	char right_widget[TAC5XX2_WIDGET_NAME_MAX];
-	int ret;
 
 	if (strlen(name_prefix) > (TAC5XX2_WIDGET_NAME_MAX - 7))
 		return -ENAMETOOLONG;
 
-	ret = scnprintf(left_widget, sizeof(left_widget), "%s SPK_L", name_prefix);
-	if (ret <= 0)
-		return -EINVAL;
-
-	ret = scnprintf(right_widget, sizeof(right_widget), "%s SPK_R", name_prefix);
-	if (ret <= 0)
-		return -EINVAL;
+	scnprintf(left_widget, sizeof(left_widget), "%s SPK_L", name_prefix);
+	scnprintf(right_widget, sizeof(right_widget), "%s SPK_R", name_prefix);
 
 	routes[0] = (struct snd_soc_dapm_route){"Left Spk", NULL, left_widget};
 	routes[1] = (struct snd_soc_dapm_route){"Right Spk", NULL, right_widget};
-- 
2.34.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] ASoC: sdw_utils: Remove dead code in asoc_sdw_ti_add_tac5xx2_routes()
  2026-05-13  1:55 [PATCH v2] ASoC: sdw_utils: Remove dead code in asoc_sdw_ti_add_tac5xx2_routes() Niranjan H Y
@ 2026-05-14  0:51 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2026-05-14  0:51 UTC (permalink / raw)
  To: linux-sound, Niranjan H Y
  Cc: linux-kernel, ckeepax, lgirdwood, perex, tiwai, cezary.rojewski,
	peter.ujfalusi, yung-chuan.liao, kai.vehmanen,
	pierre-louis.bossart, baojun.xu, shenghao-ding, sandeepk,
	v-hampiholi, Dan Carpenter

On Wed, 13 May 2026 07:25:42 +0530, Niranjan H Y wrote:
> ASoC: sdw_utils: Remove dead code in asoc_sdw_ti_add_tac5xx2_routes()

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.2

Thanks!

[1/1] ASoC: sdw_utils: Remove dead code in asoc_sdw_ti_add_tac5xx2_routes()
      https://git.kernel.org/broonie/sound/c/c157f03b4864

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] 2+ messages in thread

end of thread, other threads:[~2026-05-15 16:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-13  1:55 [PATCH v2] ASoC: sdw_utils: Remove dead code in asoc_sdw_ti_add_tac5xx2_routes() Niranjan H Y
2026-05-14  0:51 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®