From: Dan Carpenter <error27@gmail.com>
To: Niranjan H Y <niranjan.hy@ti.com>
Cc: linux-sound@vger.kernel.org
Subject: [bug report] ASoC: sdw_utils: TI amp utility for tac5xx2 family
Date: Mon, 11 May 2026 09:50:00 +0300 [thread overview]
Message-ID: <agF8GBcHYUaGJbXY@stanley.mountain> (raw)
Hello Niranjan H Y,
Commit e812de61e9a0 ("ASoC: sdw_utils: TI amp utility for tac5xx2
family") from May 5, 2026 (linux-next), leads to the following Smatch
static checker warning:
sound/soc/sdw_utils/soc_sdw_ti_amp.c:114 asoc_sdw_ti_add_tac5xx2_routes()
warn: why check scnprintf return value?
sound/soc/sdw_utils/soc_sdw_ti_amp.c
102 static int asoc_sdw_ti_add_tac5xx2_routes(struct snd_soc_dapm_context *dapm,
103 const char *name_prefix)
104 {
105 struct snd_soc_dapm_route routes[2];
106 char left_widget[TAC5XX2_WIDGET_NAME_MAX];
107 char right_widget[TAC5XX2_WIDGET_NAME_MAX];
108 int ret;
109
110 if (strlen(name_prefix) > (TAC5XX2_WIDGET_NAME_MAX - 7))
111 return -ENAMETOOLONG;
112
113 ret = scnprintf(left_widget, sizeof(left_widget), "%s SPK_L", name_prefix);
--> 114 if (ret <= 0)
115 return -EINVAL;
^^^^^^^^^^^^^^^^^^^^^^^
scnprintf() returns the number of bytes it was able to fit into
TAC5XX2_WIDGET_NAME_MAX, not counting the NUL character. It
never returns negatives and it's not going to return zero either.
This is just dead code.
116
117 ret = scnprintf(right_widget, sizeof(right_widget), "%s SPK_R", name_prefix);
118 if (ret <= 0)
119 return -EINVAL;
^^^^^^^^^^^^^^^^^^^^^^^
Same.
120
121 routes[0] = (struct snd_soc_dapm_route){"Left Spk", NULL, left_widget};
122 routes[1] = (struct snd_soc_dapm_route){"Right Spk", NULL, right_widget};
123
124 return snd_soc_dapm_add_routes(dapm, routes, ARRAY_SIZE(routes));
125 }
This email is a free service from the Smatch-CI project [smatch.sf.net].
regards,
dan carpenter
reply other threads:[~2026-05-11 6:50 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=agF8GBcHYUaGJbXY@stanley.mountain \
--to=error27@gmail.com \
--cc=linux-sound@vger.kernel.org \
--cc=niranjan.hy@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox