All of lore.kernel.org
 help / color / mirror / Atom feed
* [ras:edac-drivers 1/1] drivers/edac/synopsys_edac.c:1405:6: warning: variable 'rc' is used uninitialized whenever 'if' condition is true
@ 2025-07-14  3:04 kernel test robot
  2025-07-14 10:15 ` Borislav Petkov
  0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2025-07-14  3:04 UTC (permalink / raw)
  To: Shubhrajyoti Datta; +Cc: llvm, oe-kbuild-all, Borislav Petkov (AMD)

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/202507141048.obUv3ZUm-lkp@intel.com/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/202507141048.obUv3ZUm-lkp@intel.com/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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202507141048.obUv3ZUm-lkp@intel.com/

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	

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [ras:edac-drivers 1/1] drivers/edac/synopsys_edac.c:1405:6: warning: variable 'rc' is used uninitialized whenever 'if' condition is true
  2025-07-14  3:04 [ras:edac-drivers 1/1] drivers/edac/synopsys_edac.c:1405:6: warning: variable 'rc' is used uninitialized whenever 'if' condition is true kernel test robot
@ 2025-07-14 10:15 ` Borislav Petkov
  0 siblings, 0 replies; 2+ messages in thread
From: Borislav Petkov @ 2025-07-14 10:15 UTC (permalink / raw)
  To: kernel test robot; +Cc: Shubhrajyoti Datta, llvm, oe-kbuild-all

On Mon, Jul 14, 2025 at 11:04:12AM +0800, kernel test robot wrote:
> 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/202507141048.obUv3ZUm-lkp@intel.com/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/202507141048.obUv3ZUm-lkp@intel.com/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 <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202507141048.obUv3ZUm-lkp@intel.com/
> 
> All warnings (new ones prefixed by >>):

Thanks, I'll merge this into the patch:

---

diff --git a/drivers/edac/synopsys_edac.c b/drivers/edac/synopsys_edac.c
index a0d101aa15f7..51143b3257de 100644
--- a/drivers/edac/synopsys_edac.c
+++ b/drivers/edac/synopsys_edac.c
@@ -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;
 	}


-- 
Regards/Gruss,
    Boris.

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-07-14 10:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-14  3:04 [ras:edac-drivers 1/1] drivers/edac/synopsys_edac.c:1405:6: warning: variable 'rc' is used uninitialized whenever 'if' condition is true kernel test robot
2025-07-14 10:15 ` Borislav Petkov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.