ASoC: codecs: rt1320-sdw: Refactor to reduce stack frames
Subsystems (3)
PATCH v2 1/1 ASoC: codecs: rt1320-sdw: Refactor to reduce stack frames
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.
---
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(-)
sound/soc/codecs/rt1320-sdw.c +13 -30
@@ -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",
Signature · 1 line
2.50.1
Mark Brown
maintainerQuoted 8 lines · 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=][...]
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