From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Mark Brown <broonie@kernel.org>,
Shuming Fan <shumingf@realtek.com>,
linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Oder Chiou <oder_chiou@realtek.com>,
Liam Girdwood <lgirdwood@gmail.com>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: [PATCH v1 1/1] ASoC: codecs: rt1320-sdw: Refactor to reduce stack frames
Date: Sat, 24 Jan 2026 00:50:50 +0100 [thread overview]
Message-ID: <20260123235050.2837942-1-andriy.shevchenko@linux.intel.com> (raw)
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>
---
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..051c471a0731 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;
+ size_t 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;
+ size_t 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
next reply other threads:[~2026-01-23 23:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-23 23:50 Andy Shevchenko [this message]
2026-01-24 6:29 ` [PATCH v1 1/1] ASoC: codecs: rt1320-sdw: Refactor to reduce stack frames kernel test robot
2026-01-24 8:57 ` kernel test robot
2026-01-24 11:30 ` kernel test robot
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=20260123235050.2837942-1-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=oder_chiou@realtek.com \
--cc=perex@perex.cz \
--cc=shumingf@realtek.com \
--cc=tiwai@suse.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