* [PATCH v2 1/1] ASoC: codecs: rt1320-sdw: Refactor to reduce stack frames
@ 2026-01-24 10:17 Andy Shevchenko
2026-01-27 12:09 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2026-01-24 10:17 UTC (permalink / raw)
To: Mark Brown, Shuming Fan, linux-sound, linux-kernel
Cc: Oder Chiou, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
Andy Shevchenko
Compiler is not happy about used stack frames in a couple of functions:
sound/soc/codecs/rt1320-sdw.c: In function 'rt1320_rae_load':
sound/soc/codecs/rt1320-sdw.c:1570:1: error: the frame size of 1336 bytes is larger than 1280 bytes [-Werror=frame-larger-than=]
sound/soc/codecs/rt1320-sdw.c: In function 'rt1320_dspfw_load_code':
sound/soc/codecs/rt1320-sdw.c:1786:1: error: the frame size of 1520 bytes is larger than 1280 bytes [-Werror=frame-larger-than=]
Refactor the code to fix these.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2: moved to int type for variable width in the string specifier (LKP)
sound/soc/codecs/rt1320-sdw.c | 43 +++++++++++------------------------
1 file changed, 13 insertions(+), 30 deletions(-)
diff --git a/sound/soc/codecs/rt1320-sdw.c b/sound/soc/codecs/rt1320-sdw.c
index 5e8a67eeb08e..e849c9772665 100644
--- a/sound/soc/codecs/rt1320-sdw.c
+++ b/sound/soc/codecs/rt1320-sdw.c
@@ -1429,8 +1429,7 @@ static int rt1320_rae_load(struct rt1320_sdw_priv *rt1320)
unsigned int addr, size;
unsigned int func, value;
const char *dmi_vendor, *dmi_product, *dmi_sku;
- char vendor[128], product[128], sku[128];
- char *ptr_vendor, *ptr_product, *ptr_sku;
+ int len_vendor, len_product, len_sku;
char rae_filename[512];
char tag[5];
int ret = 0;
@@ -1441,21 +1440,13 @@ static int rt1320_rae_load(struct rt1320_sdw_priv *rt1320)
dmi_sku = dmi_get_system_info(DMI_PRODUCT_SKU);
if (dmi_vendor && dmi_product && dmi_sku) {
- strscpy(vendor, dmi_vendor);
- strscpy(product, dmi_product);
- strscpy(sku, dmi_sku);
- ptr_vendor = &vendor[0];
- ptr_product = &product[0];
- ptr_sku = &sku[0];
- ptr_vendor = strsep(&ptr_vendor, " ");
- ptr_product = strsep(&ptr_product, " ");
- ptr_sku = strsep(&ptr_sku, " ");
-
- dev_dbg(dev, "%s: DMI vendor=%s, product=%s, sku=%s\n", __func__,
- vendor, product, sku);
+ len_vendor = strchrnul(dmi_vendor, ' ') - dmi_vendor;
+ len_product = strchrnul(dmi_product, ' ') - dmi_product;
+ len_sku = strchrnul(dmi_sku, ' ') - dmi_sku;
snprintf(rae_filename, sizeof(rae_filename),
- "realtek/rt1320/rt1320_RAE_%s_%s_%s.dat", vendor, product, sku);
+ "realtek/rt1320/rt1320_RAE_%.*s_%.*s_%.*s.dat",
+ len_vendor, dmi_vendor, len_product, dmi_product, len_sku, dmi_sku);
dev_dbg(dev, "%s: try to load RAE file %s\n", __func__, rae_filename);
} else {
dev_warn(dev, "%s: Can't find proper RAE file name\n", __func__);
@@ -1595,8 +1586,7 @@ struct rt1320_dspfwheader {
static const char hdr_sig[] = "AFX";
unsigned int hdr_size = 0;
const char *dmi_vendor, *dmi_product, *dmi_sku;
- char vendor[128], product[128], sku[128];
- char *ptr_vendor, *ptr_product, *ptr_sku;
+ int len_vendor, len_product, len_sku;
char filename[512];
switch (rt1320->dev_id) {
@@ -1616,21 +1606,14 @@ struct rt1320_dspfwheader {
dmi_sku = dmi_get_system_info(DMI_PRODUCT_SKU);
if (dmi_vendor && dmi_product && dmi_sku) {
- strscpy(vendor, dmi_vendor);
- strscpy(product, dmi_product);
- strscpy(sku, dmi_sku);
- ptr_vendor = &vendor[0];
- ptr_product = &product[0];
- ptr_sku = &sku[0];
- ptr_vendor = strsep(&ptr_vendor, " ");
- ptr_product = strsep(&ptr_product, " ");
- ptr_sku = strsep(&ptr_sku, " ");
-
- dev_dbg(dev, "%s: DMI vendor=%s, product=%s, sku=%s\n", __func__,
- vendor, product, sku);
+ len_vendor = strchrnul(dmi_vendor, ' ') - dmi_vendor;
+ len_product = strchrnul(dmi_product, ' ') - dmi_product;
+ len_sku = strchrnul(dmi_sku, ' ') - dmi_sku;
snprintf(filename, sizeof(filename),
- "realtek/rt1320/rt1320_%s_%s_%s.dat", vendor, product, sku);
+ "realtek/rt1320/rt1320_%.*s_%.*s_%.*s.dat",
+ len_vendor, dmi_vendor, len_product, dmi_product, len_sku, dmi_sku);
+
dev_dbg(dev, "%s: try to load FW file %s\n", __func__, filename);
} else if (rt1320->dspfw_name) {
snprintf(filename, sizeof(filename), "rt1320_%s.dat",
--
2.50.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2 1/1] ASoC: codecs: rt1320-sdw: Refactor to reduce stack frames
2026-01-24 10:17 [PATCH v2 1/1] ASoC: codecs: rt1320-sdw: Refactor to reduce stack frames Andy Shevchenko
@ 2026-01-27 12:09 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2026-01-27 12:09 UTC (permalink / raw)
To: Shuming Fan, linux-sound, linux-kernel, Andy Shevchenko
Cc: Oder Chiou, Liam Girdwood, Jaroslav Kysela, Takashi Iwai
On Sat, 24 Jan 2026 11:17:03 +0100, Andy Shevchenko wrote:
> Compiler is not happy about used stack frames in a couple of functions:
>
> sound/soc/codecs/rt1320-sdw.c: In function 'rt1320_rae_load':
> sound/soc/codecs/rt1320-sdw.c:1570:1: error: the frame size of 1336 bytes is larger than 1280 bytes [-Werror=frame-larger-than=]
> sound/soc/codecs/rt1320-sdw.c: In function 'rt1320_dspfw_load_code':
> sound/soc/codecs/rt1320-sdw.c:1786:1: error: the frame size of 1520 bytes is larger than 1280 bytes [-Werror=frame-larger-than=]
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/1] ASoC: codecs: rt1320-sdw: Refactor to reduce stack frames
commit: 233ccfe911aa62c0f9211f2e3297d6a7f870b295
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-01-27 12:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-24 10:17 [PATCH v2 1/1] ASoC: codecs: rt1320-sdw: Refactor to reduce stack frames Andy Shevchenko
2026-01-27 12:09 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox