Skip to contentSkip to conversation

drivers/edac/synopsys_edac.c:1405:6: warning: variable 'rc' is used uninitialized whenever 'if' condition is true

PATCH kernel test robot 2 participants 2 messages Jul 14, 2025

Subsystems (2)
lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/ras/ras.git edac-drivers
head:   3e2923c48e75f69f988c9cafd1fd2fbca4fc05f6
commit: 3e2923c48e75f69f988c9cafd1fd2fbca4fc05f6 [1/1] EDAC/synopsys: Clear the ECC counters on init
config: arm64-allmodconfig (https://download.01.org/0day-ci/archive/20250714/[email protected]/config)
compiler: clang version 19.1.7 (https://github.com/llvm/llvm-project cd708029e0b2869e80abe31ddb175f7c35361f90)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250714/[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 >>):

>> drivers/edac/synopsys_edac.c:1405:6: warning: variable 'rc' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
    1405 |         if (!get_ecc_state(priv)) {
         |             ^~~~~~~~~~~~~~~~~~~~
   drivers/edac/synopsys_edac.c:1453:9: note: uninitialized use occurs here
    1453 |         return rc;
         |                ^~
   drivers/edac/synopsys_edac.c:1405:2: note: remove the 'if' if its condition is always false
    1405 |         if (!get_ecc_state(priv)) {
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
    1406 |                 edac_printk(KERN_INFO, EDAC_MC, "ECC not enabled\n");
         |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1407 |                 goto free_edac_mc;
         |                 ~~~~~~~~~~~~~~~~~~
    1408 |         }
         |         ~
   drivers/edac/synopsys_edac.c:1376:8: note: initialize the variable 'rc' to silence this warning
    1376 |         int rc;
         |               ^
         |                = 0

1 warning generated.

vim +1405 drivers/edac/synopsys_edac.c

1359
1360 /**
1361 * mc_probe - Check controller and bind driver.
1362 * @pdev: platform device.
1363 *
1364 * Probe a specific controller instance for binding with the driver.
1365 *
1366 * Return: 0 if the controller instance was successfully bound to the
1367 * driver; otherwise, < 0 on error.
1368 */
1369 static int mc_probe(struct platform_device *pdev)
1370 {
1371 const struct synps_platform_data *p_data;
1372 struct edac_mc_layer layers[2];
1373 struct synps_edac_priv *priv;
1374 struct mem_ctl_info *mci;
1375 void __iomem *baseaddr;
1376 int rc;
1377
1378 baseaddr = devm_platform_ioremap_resource(pdev, 0);
1379 if (IS_ERR(baseaddr))
1380 return PTR_ERR(baseaddr);
1381
1382 p_data = of_device_get_match_data(&pdev->dev);
1383 if (!p_data)
1384 return -ENODEV;
1385
1386
1387 layers[0].type = EDAC_MC_LAYER_CHIP_SELECT;
1388 layers[0].size = SYNPS_EDAC_NR_CSROWS;
1389 layers[0].is_virt_csrow = true;
1390 layers[1].type = EDAC_MC_LAYER_CHANNEL;
1391 layers[1].size = SYNPS_EDAC_NR_CHANS;
1392 layers[1].is_virt_csrow = false;
1393
1394 mci = edac_mc_alloc(0, ARRAY_SIZE(layers), layers,
1395 sizeof(struct synps_edac_priv));
1396 if (!mci) {
1397 edac_printk(KERN_ERR, EDAC_MC,
1398 "Failed memory allocation for mc instance\n");
1399 return -ENOMEM;
1400 }
1401
1402 priv = mci->pvt_info;
1403 priv->baseaddr = baseaddr;
1404 priv->p_data = p_data;

> 1405		if (!get_ecc_state(priv)) {

1406 edac_printk(KERN_INFO, EDAC_MC, "ECC not enabled\n");
1407 goto free_edac_mc;
1408 }
1409
1410 spin_lock_init(&priv->reglock);
1411
1412 mc_init(mci, pdev);
1413
1414 if (priv->p_data->quirks & DDR_ECC_INTR_SUPPORT) {
1415 rc = setup_irq(mci, pdev);
1416 if (rc)
1417 goto free_edac_mc;
1418 }
1419
1420 rc = edac_mc_add_mc(mci);
1421 if (rc) {
1422 edac_printk(KERN_ERR, EDAC_MC,
1423 "Failed to register with EDAC core\n");
1424 goto free_edac_mc;
1425 }
1426

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
maintainer
#1 lore raw
Quoted 7 lines · kernel test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/ras/ras.git edac-drivers
head:   3e2923c48e75f69f988c9cafd1fd2fbca4fc05f6
commit: 3e2923c48e75f69f988c9cafd1fd2fbca4fc05f6 [1/1] EDAC/synopsys: Clear the ECC counters on init
config: arm64-allmodconfig (https://download.01.org/0day-ci/archive/20250714/[email protected]/config)
compiler: clang version 19.1.7 (https://github.com/llvm/llvm-project cd708029e0b2869e80abe31ddb175f7c35361f90)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250714/[email protected]/reproduce)
Quoted 6 lines

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 >>):

Thanks, I'll merge this into the patch:

---

drivers/edac/synopsys_edac.c +1 -0
index a0d101aa15f7..51143b3257de 100644
@@ -1404,6 +1404,7 @@ static int mc_probe(struct platform_device *pdev)
 	priv->p_data = p_data;
 	if (!get_ecc_state(priv)) {
 		edac_printk(KERN_INFO, EDAC_MC, "ECC not enabled\n");
+		rc = -ENODEV;
 		goto free_edac_mc;
 	}
 
Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette