Skip to contentSkip to conversation

ASoC: codecs: rt1320-sdw: Refactor to reduce stack frames

PATCH Superseded Andy Shevchenko 2 participants 4 messages Jan 23 – Jan 24

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 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.

---
 sound/soc/codecs/rt1320-sdw.c | 43 +++++++++++------------------------
 1 file changed, 13 insertions(+), 30 deletions(-)
sound/soc/codecs/rt1320-sdw.c +13 -30
index 5e8a67eeb08e..051c471a0731 100644
@@ -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",
Signature · 1 line
2.50.1
#1 lore raw
kernel test robot noticed the following build warnings:

Hi Andy,

kernel test robot noticed the following build warnings:

[auto build test WARNING on broonie-sound/for-next]
[also build test WARNING on next-20260123]
[cannot apply to tiwai-sound/for-next tiwai-sound/for-linus linus/master v6.19-rc6] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Andy-Shevchenko/ASoC-codecs-rt1320-sdw-Refactor-to-reduce-stack-frames/20260124-075303
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
patch link:    https://lore.kernel.org/r/20260123235050.2837942-1-andriy.shevchenko%40linux.intel.com
patch subject: [PATCH v1 1/1] ASoC: codecs: rt1320-sdw: Refactor to reduce stack frames
config: x86_64-buildonly-randconfig-002-20260124 (https://download.01.org/0day-ci/archive/20260124/[email protected]/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260124/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

sound/soc/codecs/rt1320-sdw.c: In function 'rt1320_rae_load':

>> sound/soc/codecs/rt1320-sdw.c:1448:55: warning: field precision specifier '.*' expects argument of type 'int', but argument 4 has type 'size_t' {aka 'long unsigned int'} [-Wformat=]
    1448 |                          "realtek/rt1320/rt1320_RAE_%.*s_%.*s_%.*s.dat",
         |                                                     ~~^~
         |                                                       |
         |                                                       int
    1449 |                          len_vendor, dmi_vendor, len_product, dmi_product, len_sku, dmi_sku);
         |                          ~~~~~~~~~~                    
         |                          |
         |                          size_t {aka long unsigned int}
   sound/soc/codecs/rt1320-sdw.c:1448:60: warning: field precision specifier '.*' expects argument of type 'int', but argument 6 has type 'size_t' {aka 'long unsigned int'} [-Wformat=]
    1448 |                          "realtek/rt1320/rt1320_RAE_%.*s_%.*s_%.*s.dat",
         |                                                          ~~^~
         |                                                            |
         |                                                            int
    1449 |                          len_vendor, dmi_vendor, len_product, dmi_product, len_sku, dmi_sku);
         |                                                  ~~~~~~~~~~~
         |                                                  |
         |                                                  size_t {aka long unsigned int}
   sound/soc/codecs/rt1320-sdw.c:1448:65: warning: field precision specifier '.*' expects argument of type 'int', but argument 8 has type 'size_t' {aka 'long unsigned int'} [-Wformat=]
    1448 |                          "realtek/rt1320/rt1320_RAE_%.*s_%.*s_%.*s.dat",
         |                                                               ~~^~
         |                                                                 |
         |                                                                 int
    1449 |                          len_vendor, dmi_vendor, len_product, dmi_product, len_sku, dmi_sku);
         |                                                                            ~~~~~~~
         |                                                                            |
         |                                                                            size_t {aka long unsigned int}
   sound/soc/codecs/rt1320-sdw.c: In function 'rt1320_dspfw_load_code':
   sound/soc/codecs/rt1320-sdw.c:1614:51: warning: field precision specifier '.*' expects argument of type 'int', but argument 4 has type 'size_t' {aka 'long unsigned int'} [-Wformat=]
    1614 |                          "realtek/rt1320/rt1320_%.*s_%.*s_%.*s.dat",
         |                                                 ~~^~
         |                                                   |
         |                                                   int
    1615 |                          len_vendor, dmi_vendor, len_product, dmi_product, len_sku, dmi_sku);
         |                          ~~~~~~~~~~                
         |                          |
         |                          size_t {aka long unsigned int}
   sound/soc/codecs/rt1320-sdw.c:1614:56: warning: field precision specifier '.*' expects argument of type 'int', but argument 6 has type 'size_t' {aka 'long unsigned int'} [-Wformat=]
    1614 |                          "realtek/rt1320/rt1320_%.*s_%.*s_%.*s.dat",
         |                                                      ~~^~
         |                                                        |
         |                                                        int
    1615 |                          len_vendor, dmi_vendor, len_product, dmi_product, len_sku, dmi_sku);
         |                                                  ~~~~~~~~~~~
         |                                                  |
         |                                                  size_t {aka long unsigned int}
   sound/soc/codecs/rt1320-sdw.c:1614:61: warning: field precision specifier '.*' expects argument of type 'int', but argument 8 has type 'size_t' {aka 'long unsigned int'} [-Wformat=]
    1614 |                          "realtek/rt1320/rt1320_%.*s_%.*s_%.*s.dat",
         |                                                           ~~^~
         |                                                             |
         |                                                             int
    1615 |                          len_vendor, dmi_vendor, len_product, dmi_product, len_sku, dmi_sku);
         |                                                                            ~~~~~~~
         |                                                                            |
         |                                                                            size_t {aka long unsigned int}

vim +1448 sound/soc/codecs/rt1320-sdw.c

1419
1420 static int rt1320_rae_load(struct rt1320_sdw_priv *rt1320)
1421 {
1422 struct device *dev = &rt1320->sdw_slave->dev;
1423 static const char func_tag[] = "FUNC";
1424 static const char xu_tag[] = "XU";
1425 const struct firmware *rae_fw = NULL;
1426 unsigned int fw_offset;
1427 unsigned char *fw_data;
1428 unsigned char *param_data;
1429 unsigned int addr, size;
1430 unsigned int func, value;
1431 const char *dmi_vendor, *dmi_product, *dmi_sku;
1432 size_t len_vendor, len_product, len_sku;
1433 char rae_filename[512];
1434 char tag[5];
1435 int ret = 0;
1436 int retry = 200;
1437
1438 dmi_vendor = dmi_get_system_info(DMI_SYS_VENDOR);
1439 dmi_product = dmi_get_system_info(DMI_PRODUCT_NAME);
1440 dmi_sku = dmi_get_system_info(DMI_PRODUCT_SKU);
1441
1442 if (dmi_vendor && dmi_product && dmi_sku) {
1443 len_vendor = strchrnul(dmi_vendor, ' ') - dmi_vendor;
1444 len_product = strchrnul(dmi_product, ' ') - dmi_product;
1445 len_sku = strchrnul(dmi_sku, ' ') - dmi_sku;
1446
1447 snprintf(rae_filename, sizeof(rae_filename),

> 1448				 "realtek/rt1320/rt1320_RAE_%.*s_%.*s_%.*s.dat",

1449 len_vendor, dmi_vendor, len_product, dmi_product, len_sku, dmi_sku);
1450 dev_dbg(dev, "%s: try to load RAE file %s\n", __func__, rae_filename);
1451 } else {
1452 dev_warn(dev, "%s: Can't find proper RAE file name\n", __func__);
1453 return -EINVAL;
1454 }
1455
1456 regmap_write(rt1320->regmap,
1457 SDW_SDCA_CTL(FUNC_NUM_AMP, RT1320_SDCA_ENT_PDE23,
1458 RT1320_SDCA_CTL_REQ_POWER_STATE, 0), 0x00);
1459 rt1320_pde_transition_delay(rt1320, FUNC_NUM_AMP, RT1320_SDCA_ENT_PDE23, 0x00);
1460
1461 request_firmware(&rae_fw, rae_filename, dev);
1462 if (rae_fw) {
1463
1464 /* RAE CRC clear */
1465 regmap_write(rt1320->regmap, 0xe80b, 0x0f);
1466
1467 /* RAE stop & CRC disable */
1468 regmap_update_bits(rt1320->regmap, 0xe803, 0xbc, 0x00);
1469
1470 while (--retry) {
1471 regmap_read(rt1320->regmap, 0xe83f, &value);
1472 if (value & 0x40)
1473 break;
1474 usleep_range(1000, 1100);
1475 }
1476 if (!retry && !(value & 0x40)) {
1477 dev_err(dev, "%s: RAE is not ready to load\n", __func__);
1478 return -ETIMEDOUT;
1479 }
1480
1481 dev_dbg(dev, "%s, rae_fw size=0x%zx\n", __func__, rae_fw->size);
1482 regcache_cache_bypass(rt1320->regmap, true);
1483 for (fw_offset = 0; fw_offset < rae_fw->size;) {
1484
1485 dev_dbg(dev, "%s, fw_offset=0x%x\n", __func__, fw_offset);
1486
1487 fw_data = (unsigned char *)&rae_fw->data[fw_offset];
1488
1489 memcpy(tag, fw_data, 4);
1490 tag[4] = '\0';
1491 dev_dbg(dev, "%s, tag=%s\n", __func__, tag);
1492 if (strcmp(tag, xu_tag) == 0) {
1493 dev_dbg(dev, "%s: This is a XU tag", __func__);
1494 memcpy(&addr, (fw_data + 4), 4);
1495 memcpy(&size, (fw_data + 8), 4);
1496 param_data = (unsigned char *)(fw_data + 12);
1497
1498 dev_dbg(dev, "%s: addr=0x%x, size=0x%x\n", __func__, addr, size);
1499
1500 /*
1501 * UI register ranges from 0x1000d000 to 0x1000d7ff
1502 * UI registers should be accessed by tuning tool.
1503 * So, there registers should be cached.
1504 */
1505 if (addr <= 0x1000d7ff && addr >= 0x1000d000)
1506 regcache_cache_bypass(rt1320->regmap, false);
1507
1508 rt1320_data_rw(rt1320, addr, param_data, size, RT1320_PARAM_WRITE);
1509
1510 regcache_cache_bypass(rt1320->regmap, true);
1511
1512 fw_offset += (size + 12);
1513 } else if (strcmp(tag, func_tag) == 0) {
1514 dev_err(dev, "%s: This is a FUNC tag", __func__);
1515
1516 memcpy(&func, (fw_data + 4), 4);
1517 memcpy(&value, (fw_data + 8), 4);
1518
1519 dev_dbg(dev, "%s: func=0x%x, value=0x%x\n", __func__, func, value);
1520 if (func == 1) //DelayMs
1521 msleep(value);
1522
1523 fw_offset += 12;
1524 } else {
1525 dev_err(dev, "%s: This is NOT a XU file (wrong tag)", __func__);
1526 break;
1527 }
1528 }
1529
1530 regcache_cache_bypass(rt1320->regmap, false);
1531 release_firmware(rae_fw);
1532
1533 } else {
1534 dev_err(dev, "%s: Failed to load %s firmware\n", __func__, rae_filename);
1535 ret = -EINVAL;
1536 goto _exit_;
1537 }
1538
1539 /* RAE CRC enable */
1540 regmap_update_bits(rt1320->regmap, 0xe803, 0x0c, 0x0c);
1541
1542 /* RAE update */
1543 regmap_update_bits(rt1320->regmap, 0xe80b, 0x80, 0x00);
1544 regmap_update_bits(rt1320->regmap, 0xe80b, 0x80, 0x80);
1545
1546 /* RAE run */
1547 regmap_update_bits(rt1320->regmap, 0xe803, 0x80, 0x80);
1548
1549 regmap_read(rt1320->regmap, 0xe80b, &value);
1550 dev_dbg(dev, "%s: CAE run => 0xe80b reg = 0x%x\n", __func__, value);
1551
1552 rt1320->rae_update_done = true;
1553
1554 _exit_:
1555 regmap_write(rt1320->regmap,
1556 SDW_SDCA_CTL(FUNC_NUM_AMP, RT1320_SDCA_ENT_PDE23,
1557 RT1320_SDCA_CTL_REQ_POWER_STATE, 0), 0x03);
1558 rt1320_pde_transition_delay(rt1320, FUNC_NUM_AMP, RT1320_SDCA_ENT_PDE23, 0x03);
1559
1560 return ret;
1561 }
1562

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#2 lore raw
In reply to Andy Shevchenko
kernel test robot noticed the following build warnings:

Hi Andy,

kernel test robot noticed the following build warnings:

[auto build test WARNING on broonie-sound/for-next]
[also build test WARNING on next-20260123]
[cannot apply to tiwai-sound/for-next tiwai-sound/for-linus linus/master v6.19-rc6] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Andy-Shevchenko/ASoC-codecs-rt1320-sdw-Refactor-to-reduce-stack-frames/20260124-075303
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
patch link:    https://lore.kernel.org/r/20260123235050.2837942-1-andriy.shevchenko%40linux.intel.com
patch subject: [PATCH v1 1/1] ASoC: codecs: rt1320-sdw: Refactor to reduce stack frames
config: x86_64-rhel-9.4-rust (https://download.01.org/0day-ci/archive/20260124/[email protected]/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
rustc: rustc 1.88.0 (6b00bc388 2025-06-23)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260124/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

>> sound/soc/codecs/rt1320-sdw.c:1448:34: warning: field precision should have type 'int', but argument has type 'size_t' (aka 'unsigned long') [-Wformat]
    1448 |                          "realtek/rt1320/rt1320_RAE_%.*s_%.*s_%.*s.dat",
         |                                                     ~~^~
    1449 |                          len_vendor, dmi_vendor, len_product, dmi_product, len_sku, dmi_sku);
         |                          ~~~~~~~~~~
   sound/soc/codecs/rt1320-sdw.c:1614:30: warning: field precision should have type 'int', but argument has type 'size_t' (aka 'unsigned long') [-Wformat]
    1614 |                          "realtek/rt1320/rt1320_%.*s_%.*s_%.*s.dat",
         |                                                 ~~^~
    1615 |                          len_vendor, dmi_vendor, len_product, dmi_product, len_sku, dmi_sku);
         |                          ~~~~~~~~~~

2 warnings generated.

vim +1448 sound/soc/codecs/rt1320-sdw.c

1419
1420 static int rt1320_rae_load(struct rt1320_sdw_priv *rt1320)
1421 {
1422 struct device *dev = &rt1320->sdw_slave->dev;
1423 static const char func_tag[] = "FUNC";
1424 static const char xu_tag[] = "XU";
1425 const struct firmware *rae_fw = NULL;
1426 unsigned int fw_offset;
1427 unsigned char *fw_data;
1428 unsigned char *param_data;
1429 unsigned int addr, size;
1430 unsigned int func, value;
1431 const char *dmi_vendor, *dmi_product, *dmi_sku;
1432 size_t len_vendor, len_product, len_sku;
1433 char rae_filename[512];
1434 char tag[5];
1435 int ret = 0;
1436 int retry = 200;
1437
1438 dmi_vendor = dmi_get_system_info(DMI_SYS_VENDOR);
1439 dmi_product = dmi_get_system_info(DMI_PRODUCT_NAME);
1440 dmi_sku = dmi_get_system_info(DMI_PRODUCT_SKU);
1441
1442 if (dmi_vendor && dmi_product && dmi_sku) {
1443 len_vendor = strchrnul(dmi_vendor, ' ') - dmi_vendor;
1444 len_product = strchrnul(dmi_product, ' ') - dmi_product;
1445 len_sku = strchrnul(dmi_sku, ' ') - dmi_sku;
1446
1447 snprintf(rae_filename, sizeof(rae_filename),

> 1448				 "realtek/rt1320/rt1320_RAE_%.*s_%.*s_%.*s.dat",

1449 len_vendor, dmi_vendor, len_product, dmi_product, len_sku, dmi_sku);
1450 dev_dbg(dev, "%s: try to load RAE file %s\n", __func__, rae_filename);
1451 } else {
1452 dev_warn(dev, "%s: Can't find proper RAE file name\n", __func__);
1453 return -EINVAL;
1454 }
1455
1456 regmap_write(rt1320->regmap,
1457 SDW_SDCA_CTL(FUNC_NUM_AMP, RT1320_SDCA_ENT_PDE23,
1458 RT1320_SDCA_CTL_REQ_POWER_STATE, 0), 0x00);
1459 rt1320_pde_transition_delay(rt1320, FUNC_NUM_AMP, RT1320_SDCA_ENT_PDE23, 0x00);
1460
1461 request_firmware(&rae_fw, rae_filename, dev);
1462 if (rae_fw) {
1463
1464 /* RAE CRC clear */
1465 regmap_write(rt1320->regmap, 0xe80b, 0x0f);
1466
1467 /* RAE stop & CRC disable */
1468 regmap_update_bits(rt1320->regmap, 0xe803, 0xbc, 0x00);
1469
1470 while (--retry) {
1471 regmap_read(rt1320->regmap, 0xe83f, &value);
1472 if (value & 0x40)
1473 break;
1474 usleep_range(1000, 1100);
1475 }
1476 if (!retry && !(value & 0x40)) {
1477 dev_err(dev, "%s: RAE is not ready to load\n", __func__);
1478 return -ETIMEDOUT;
1479 }
1480
1481 dev_dbg(dev, "%s, rae_fw size=0x%zx\n", __func__, rae_fw->size);
1482 regcache_cache_bypass(rt1320->regmap, true);
1483 for (fw_offset = 0; fw_offset < rae_fw->size;) {
1484
1485 dev_dbg(dev, "%s, fw_offset=0x%x\n", __func__, fw_offset);
1486
1487 fw_data = (unsigned char *)&rae_fw->data[fw_offset];
1488
1489 memcpy(tag, fw_data, 4);
1490 tag[4] = '\0';
1491 dev_dbg(dev, "%s, tag=%s\n", __func__, tag);
1492 if (strcmp(tag, xu_tag) == 0) {
1493 dev_dbg(dev, "%s: This is a XU tag", __func__);
1494 memcpy(&addr, (fw_data + 4), 4);
1495 memcpy(&size, (fw_data + 8), 4);
1496 param_data = (unsigned char *)(fw_data + 12);
1497
1498 dev_dbg(dev, "%s: addr=0x%x, size=0x%x\n", __func__, addr, size);
1499
1500 /*
1501 * UI register ranges from 0x1000d000 to 0x1000d7ff
1502 * UI registers should be accessed by tuning tool.
1503 * So, there registers should be cached.
1504 */
1505 if (addr <= 0x1000d7ff && addr >= 0x1000d000)
1506 regcache_cache_bypass(rt1320->regmap, false);
1507
1508 rt1320_data_rw(rt1320, addr, param_data, size, RT1320_PARAM_WRITE);
1509
1510 regcache_cache_bypass(rt1320->regmap, true);
1511
1512 fw_offset += (size + 12);
1513 } else if (strcmp(tag, func_tag) == 0) {
1514 dev_err(dev, "%s: This is a FUNC tag", __func__);
1515
1516 memcpy(&func, (fw_data + 4), 4);
1517 memcpy(&value, (fw_data + 8), 4);
1518
1519 dev_dbg(dev, "%s: func=0x%x, value=0x%x\n", __func__, func, value);
1520 if (func == 1) //DelayMs
1521 msleep(value);
1522
1523 fw_offset += 12;
1524 } else {
1525 dev_err(dev, "%s: This is NOT a XU file (wrong tag)", __func__);
1526 break;
1527 }
1528 }
1529
1530 regcache_cache_bypass(rt1320->regmap, false);
1531 release_firmware(rae_fw);
1532
1533 } else {
1534 dev_err(dev, "%s: Failed to load %s firmware\n", __func__, rae_filename);
1535 ret = -EINVAL;
1536 goto _exit_;
1537 }
1538
1539 /* RAE CRC enable */
1540 regmap_update_bits(rt1320->regmap, 0xe803, 0x0c, 0x0c);
1541
1542 /* RAE update */
1543 regmap_update_bits(rt1320->regmap, 0xe80b, 0x80, 0x00);
1544 regmap_update_bits(rt1320->regmap, 0xe80b, 0x80, 0x80);
1545
1546 /* RAE run */
1547 regmap_update_bits(rt1320->regmap, 0xe803, 0x80, 0x80);
1548
1549 regmap_read(rt1320->regmap, 0xe80b, &value);
1550 dev_dbg(dev, "%s: CAE run => 0xe80b reg = 0x%x\n", __func__, value);
1551
1552 rt1320->rae_update_done = true;
1553
1554 _exit_:
1555 regmap_write(rt1320->regmap,
1556 SDW_SDCA_CTL(FUNC_NUM_AMP, RT1320_SDCA_ENT_PDE23,
1557 RT1320_SDCA_CTL_REQ_POWER_STATE, 0), 0x03);
1558 rt1320_pde_transition_delay(rt1320, FUNC_NUM_AMP, RT1320_SDCA_ENT_PDE23, 0x03);
1559
1560 return ret;
1561 }
1562

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#3 lore raw
In reply to Andy Shevchenko
kernel test robot noticed the following build warnings:

Hi Andy,

kernel test robot noticed the following build warnings:

[auto build test WARNING on broonie-sound/for-next]
[also build test WARNING on next-20260123]
[cannot apply to tiwai-sound/for-next tiwai-sound/for-linus linus/master v6.16-rc1] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Andy-Shevchenko/ASoC-codecs-rt1320-sdw-Refactor-to-reduce-stack-frames/20260124-075303
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
patch link:    https://lore.kernel.org/r/20260123235050.2837942-1-andriy.shevchenko%40linux.intel.com
patch subject: [PATCH v1 1/1] ASoC: codecs: rt1320-sdw: Refactor to reduce stack frames
config: x86_64-rhel-9.4-kunit (https://download.01.org/0day-ci/archive/20260124/[email protected]/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260124/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

sound/soc/codecs/rt1320-sdw.c: In function 'rt1320_rae_load':

>> sound/soc/codecs/rt1320-sdw.c:1448:55: warning: field precision specifier '.*' expects argument of type 'int', but argument 4 has type 'size_t' {aka 'long unsigned int'} [-Wformat=]
    1448 |                          "realtek/rt1320/rt1320_RAE_%.*s_%.*s_%.*s.dat",
         |                                                     ~~^~
         |                                                       |
         |                                                       int
    1449 |                          len_vendor, dmi_vendor, len_product, dmi_product, len_sku, dmi_sku);
         |                          ~~~~~~~~~~                    
         |                          |
         |                          size_t {aka long unsigned int}
   sound/soc/codecs/rt1320-sdw.c:1448:60: warning: field precision specifier '.*' expects argument of type 'int', but argument 6 has type 'size_t' {aka 'long unsigned int'} [-Wformat=]
    1448 |                          "realtek/rt1320/rt1320_RAE_%.*s_%.*s_%.*s.dat",
         |                                                          ~~^~
         |                                                            |
         |                                                            int
    1449 |                          len_vendor, dmi_vendor, len_product, dmi_product, len_sku, dmi_sku);
         |                                                  ~~~~~~~~~~~
         |                                                  |
         |                                                  size_t {aka long unsigned int}
   sound/soc/codecs/rt1320-sdw.c:1448:65: warning: field precision specifier '.*' expects argument of type 'int', but argument 8 has type 'size_t' {aka 'long unsigned int'} [-Wformat=]
    1448 |                          "realtek/rt1320/rt1320_RAE_%.*s_%.*s_%.*s.dat",
         |                                                               ~~^~
         |                                                                 |
         |                                                                 int
    1449 |                          len_vendor, dmi_vendor, len_product, dmi_product, len_sku, dmi_sku);
         |                                                                            ~~~~~~~
         |                                                                            |
         |                                                                            size_t {aka long unsigned int}
   sound/soc/codecs/rt1320-sdw.c: In function 'rt1320_dspfw_load_code':
   sound/soc/codecs/rt1320-sdw.c:1614:51: warning: field precision specifier '.*' expects argument of type 'int', but argument 4 has type 'size_t' {aka 'long unsigned int'} [-Wformat=]
    1614 |                          "realtek/rt1320/rt1320_%.*s_%.*s_%.*s.dat",
         |                                                 ~~^~
         |                                                   |
         |                                                   int
    1615 |                          len_vendor, dmi_vendor, len_product, dmi_product, len_sku, dmi_sku);
         |                          ~~~~~~~~~~                
         |                          |
         |                          size_t {aka long unsigned int}
   sound/soc/codecs/rt1320-sdw.c:1614:56: warning: field precision specifier '.*' expects argument of type 'int', but argument 6 has type 'size_t' {aka 'long unsigned int'} [-Wformat=]
    1614 |                          "realtek/rt1320/rt1320_%.*s_%.*s_%.*s.dat",
         |                                                      ~~^~
         |                                                        |
         |                                                        int
    1615 |                          len_vendor, dmi_vendor, len_product, dmi_product, len_sku, dmi_sku);
         |                                                  ~~~~~~~~~~~
         |                                                  |
         |                                                  size_t {aka long unsigned int}
   sound/soc/codecs/rt1320-sdw.c:1614:61: warning: field precision specifier '.*' expects argument of type 'int', but argument 8 has type 'size_t' {aka 'long unsigned int'} [-Wformat=]
    1614 |                          "realtek/rt1320/rt1320_%.*s_%.*s_%.*s.dat",
         |                                                           ~~^~
         |                                                             |
         |                                                             int
    1615 |                          len_vendor, dmi_vendor, len_product, dmi_product, len_sku, dmi_sku);
         |                                                                            ~~~~~~~
         |                                                                            |
         |                                                                            size_t {aka long unsigned int}

vim +1448 sound/soc/codecs/rt1320-sdw.c

1419
1420 static int rt1320_rae_load(struct rt1320_sdw_priv *rt1320)
1421 {
1422 struct device *dev = &rt1320->sdw_slave->dev;
1423 static const char func_tag[] = "FUNC";
1424 static const char xu_tag[] = "XU";
1425 const struct firmware *rae_fw = NULL;
1426 unsigned int fw_offset;
1427 unsigned char *fw_data;
1428 unsigned char *param_data;
1429 unsigned int addr, size;
1430 unsigned int func, value;
1431 const char *dmi_vendor, *dmi_product, *dmi_sku;
1432 size_t len_vendor, len_product, len_sku;
1433 char rae_filename[512];
1434 char tag[5];
1435 int ret = 0;
1436 int retry = 200;
1437
1438 dmi_vendor = dmi_get_system_info(DMI_SYS_VENDOR);
1439 dmi_product = dmi_get_system_info(DMI_PRODUCT_NAME);
1440 dmi_sku = dmi_get_system_info(DMI_PRODUCT_SKU);
1441
1442 if (dmi_vendor && dmi_product && dmi_sku) {
1443 len_vendor = strchrnul(dmi_vendor, ' ') - dmi_vendor;
1444 len_product = strchrnul(dmi_product, ' ') - dmi_product;
1445 len_sku = strchrnul(dmi_sku, ' ') - dmi_sku;
1446
1447 snprintf(rae_filename, sizeof(rae_filename),

> 1448				 "realtek/rt1320/rt1320_RAE_%.*s_%.*s_%.*s.dat",

1449 len_vendor, dmi_vendor, len_product, dmi_product, len_sku, dmi_sku);
1450 dev_dbg(dev, "%s: try to load RAE file %s\n", __func__, rae_filename);
1451 } else {
1452 dev_warn(dev, "%s: Can't find proper RAE file name\n", __func__);
1453 return -EINVAL;
1454 }
1455
1456 regmap_write(rt1320->regmap,
1457 SDW_SDCA_CTL(FUNC_NUM_AMP, RT1320_SDCA_ENT_PDE23,
1458 RT1320_SDCA_CTL_REQ_POWER_STATE, 0), 0x00);
1459 rt1320_pde_transition_delay(rt1320, FUNC_NUM_AMP, RT1320_SDCA_ENT_PDE23, 0x00);
1460
1461 request_firmware(&rae_fw, rae_filename, dev);
1462 if (rae_fw) {
1463
1464 /* RAE CRC clear */
1465 regmap_write(rt1320->regmap, 0xe80b, 0x0f);
1466
1467 /* RAE stop & CRC disable */
1468 regmap_update_bits(rt1320->regmap, 0xe803, 0xbc, 0x00);
1469
1470 while (--retry) {
1471 regmap_read(rt1320->regmap, 0xe83f, &value);
1472 if (value & 0x40)
1473 break;
1474 usleep_range(1000, 1100);
1475 }
1476 if (!retry && !(value & 0x40)) {
1477 dev_err(dev, "%s: RAE is not ready to load\n", __func__);
1478 return -ETIMEDOUT;
1479 }
1480
1481 dev_dbg(dev, "%s, rae_fw size=0x%zx\n", __func__, rae_fw->size);
1482 regcache_cache_bypass(rt1320->regmap, true);
1483 for (fw_offset = 0; fw_offset < rae_fw->size;) {
1484
1485 dev_dbg(dev, "%s, fw_offset=0x%x\n", __func__, fw_offset);
1486
1487 fw_data = (unsigned char *)&rae_fw->data[fw_offset];
1488
1489 memcpy(tag, fw_data, 4);
1490 tag[4] = '\0';
1491 dev_dbg(dev, "%s, tag=%s\n", __func__, tag);
1492 if (strcmp(tag, xu_tag) == 0) {
1493 dev_dbg(dev, "%s: This is a XU tag", __func__);
1494 memcpy(&addr, (fw_data + 4), 4);
1495 memcpy(&size, (fw_data + 8), 4);
1496 param_data = (unsigned char *)(fw_data + 12);
1497
1498 dev_dbg(dev, "%s: addr=0x%x, size=0x%x\n", __func__, addr, size);
1499
1500 /*
1501 * UI register ranges from 0x1000d000 to 0x1000d7ff
1502 * UI registers should be accessed by tuning tool.
1503 * So, there registers should be cached.
1504 */
1505 if (addr <= 0x1000d7ff && addr >= 0x1000d000)
1506 regcache_cache_bypass(rt1320->regmap, false);
1507
1508 rt1320_data_rw(rt1320, addr, param_data, size, RT1320_PARAM_WRITE);
1509
1510 regcache_cache_bypass(rt1320->regmap, true);
1511
1512 fw_offset += (size + 12);
1513 } else if (strcmp(tag, func_tag) == 0) {
1514 dev_err(dev, "%s: This is a FUNC tag", __func__);
1515
1516 memcpy(&func, (fw_data + 4), 4);
1517 memcpy(&value, (fw_data + 8), 4);
1518
1519 dev_dbg(dev, "%s: func=0x%x, value=0x%x\n", __func__, func, value);
1520 if (func == 1) //DelayMs
1521 msleep(value);
1522
1523 fw_offset += 12;
1524 } else {
1525 dev_err(dev, "%s: This is NOT a XU file (wrong tag)", __func__);
1526 break;
1527 }
1528 }
1529
1530 regcache_cache_bypass(rt1320->regmap, false);
1531 release_firmware(rae_fw);
1532
1533 } else {
1534 dev_err(dev, "%s: Failed to load %s firmware\n", __func__, rae_filename);
1535 ret = -EINVAL;
1536 goto _exit_;
1537 }
1538
1539 /* RAE CRC enable */
1540 regmap_update_bits(rt1320->regmap, 0xe803, 0x0c, 0x0c);
1541
1542 /* RAE update */
1543 regmap_update_bits(rt1320->regmap, 0xe80b, 0x80, 0x00);
1544 regmap_update_bits(rt1320->regmap, 0xe80b, 0x80, 0x80);
1545
1546 /* RAE run */
1547 regmap_update_bits(rt1320->regmap, 0xe803, 0x80, 0x80);
1548
1549 regmap_read(rt1320->regmap, 0xe80b, &value);
1550 dev_dbg(dev, "%s: CAE run => 0xe80b reg = 0x%x\n", __func__, value);
1551
1552 rt1320->rae_update_done = true;
1553
1554 _exit_:
1555 regmap_write(rt1320->regmap,
1556 SDW_SDCA_CTL(FUNC_NUM_AMP, RT1320_SDCA_ENT_PDE23,
1557 RT1320_SDCA_CTL_REQ_POWER_STATE, 0), 0x03);
1558 rt1320_pde_transition_delay(rt1320, FUNC_NUM_AMP, RT1320_SDCA_ENT_PDE23, 0x03);
1559
1560 return ret;
1561 }
1562

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki