* Re: [PATCH v2] EDAC/ie31200: Fix error handling in ie31200_register_mci
[not found] <20251105022146.22105-1-make24@iscas.ac.cn>
@ 2025-11-05 20:55 ` kernel test robot
2025-11-07 16:18 ` Breno Leitao
0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2025-11-05 20:55 UTC (permalink / raw)
To: Ma Ke; +Cc: llvm, oe-kbuild-all
Hi Ma,
kernel test robot noticed the following build warnings:
[auto build test WARNING on ras/edac-for-next]
[also build test WARNING on linus/master v6.18-rc4 next-20251105]
[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/Ma-Ke/EDAC-ie31200-Fix-error-handling-in-ie31200_register_mci/20251105-102435
base: https://git.kernel.org/pub/scm/linux/kernel/git/ras/ras.git edac-for-next
patch link: https://lore.kernel.org/r/20251105022146.22105-1-make24%40iscas.ac.cn
patch subject: [PATCH v2] EDAC/ie31200: Fix error handling in ie31200_register_mci
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20251106/202511060427.k5gEuYdp-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251106/202511060427.k5gEuYdp-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/202511060427.k5gEuYdp-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/edac/ie31200_edac.c:483:6: warning: variable 'priv' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
483 | if (!window) {
| ^~~~~~~
drivers/edac/ie31200_edac.c:531:14: note: uninitialized use occurs here
531 | put_device(&priv->dev);
| ^~~~
drivers/edac/ie31200_edac.c:483:2: note: remove the 'if' if its condition is always false
483 | if (!window) {
| ^~~~~~~~~~~~~~
484 | ret = -ENODEV;
| ~~~~~~~~~~~~~~
485 | goto fail_free;
| ~~~~~~~~~~~~~~~
486 | }
| ~
drivers/edac/ie31200_edac.c:465:27: note: initialize the variable 'priv' to silence this warning
465 | struct ie31200_priv *priv;
| ^
| = NULL
1 warning generated.
vim +483 drivers/edac/ie31200_edac.c
7ee40b897d18ab Jason Baron 2014-07-04 461
d0742284ec6da1 Qiuxu Zhuo 2025-03-10 462 static int ie31200_register_mci(struct pci_dev *pdev, struct res_config *cfg, int mc)
498550e1fa7c1c Qiuxu Zhuo 2025-03-10 463 {
498550e1fa7c1c Qiuxu Zhuo 2025-03-10 464 struct edac_mc_layer layers[2];
498550e1fa7c1c Qiuxu Zhuo 2025-03-10 465 struct ie31200_priv *priv;
498550e1fa7c1c Qiuxu Zhuo 2025-03-10 466 struct mem_ctl_info *mci;
498550e1fa7c1c Qiuxu Zhuo 2025-03-10 467 void __iomem *window;
498550e1fa7c1c Qiuxu Zhuo 2025-03-10 468 int ret;
498550e1fa7c1c Qiuxu Zhuo 2025-03-10 469
7ee40b897d18ab Jason Baron 2014-07-04 470 nr_channels = how_many_channels(pdev);
7ee40b897d18ab Jason Baron 2014-07-04 471 layers[0].type = EDAC_MC_LAYER_CHIP_SELECT;
d59d844e319d97 Qiuxu Zhuo 2025-03-10 472 layers[0].size = IE31200_RANKS_PER_CHANNEL;
7ee40b897d18ab Jason Baron 2014-07-04 473 layers[0].is_virt_csrow = true;
7ee40b897d18ab Jason Baron 2014-07-04 474 layers[1].type = EDAC_MC_LAYER_CHANNEL;
7ee40b897d18ab Jason Baron 2014-07-04 475 layers[1].size = nr_channels;
7ee40b897d18ab Jason Baron 2014-07-04 476 layers[1].is_virt_csrow = false;
d0742284ec6da1 Qiuxu Zhuo 2025-03-10 477 mci = edac_mc_alloc(mc, ARRAY_SIZE(layers), layers,
7ee40b897d18ab Jason Baron 2014-07-04 478 sizeof(struct ie31200_priv));
7ee40b897d18ab Jason Baron 2014-07-04 479 if (!mci)
78fd4d1242e88f Jason Baron 2014-07-09 480 return -ENOMEM;
7ee40b897d18ab Jason Baron 2014-07-04 481
d0742284ec6da1 Qiuxu Zhuo 2025-03-10 482 window = ie31200_map_mchbar(pdev, cfg, mc);
78fd4d1242e88f Jason Baron 2014-07-09 @483 if (!window) {
78fd4d1242e88f Jason Baron 2014-07-09 484 ret = -ENODEV;
78fd4d1242e88f Jason Baron 2014-07-09 485 goto fail_free;
78fd4d1242e88f Jason Baron 2014-07-09 486 }
7ee40b897d18ab Jason Baron 2014-07-04 487
78fd4d1242e88f Jason Baron 2014-07-09 488 edac_dbg(3, "MC: init mci\n");
2a52cce6486171 Qiuxu Zhuo 2025-03-10 489 mci->mtype_cap = BIT(cfg->mtype);
7ee40b897d18ab Jason Baron 2014-07-04 490 mci->edac_ctl_cap = EDAC_FLAG_SECDED;
7ee40b897d18ab Jason Baron 2014-07-04 491 mci->edac_cap = EDAC_FLAG_SECDED;
7ee40b897d18ab Jason Baron 2014-07-04 492 mci->mod_name = EDAC_MOD_STR;
d0742284ec6da1 Qiuxu Zhuo 2025-03-10 493 mci->ctl_name = ie31200_devs[mc].ctl_name;
7ee40b897d18ab Jason Baron 2014-07-04 494 mci->dev_name = pci_name(pdev);
a5db1b296b181c Qiuxu Zhuo 2025-03-10 495 mci->edac_check = cfg->cmci ? NULL : ie31200_check;
7ee40b897d18ab Jason Baron 2014-07-04 496 mci->ctl_page_to_phys = NULL;
7ee40b897d18ab Jason Baron 2014-07-04 497 priv = mci->pvt_info;
7ee40b897d18ab Jason Baron 2014-07-04 498 priv->window = window;
2a52cce6486171 Qiuxu Zhuo 2025-03-10 499 priv->c0errlog = window + cfg->reg_eccerrlog_offset[0];
2a52cce6486171 Qiuxu Zhuo 2025-03-10 500 priv->c1errlog = window + cfg->reg_eccerrlog_offset[1];
2a52cce6486171 Qiuxu Zhuo 2025-03-10 501 priv->cfg = cfg;
d0742284ec6da1 Qiuxu Zhuo 2025-03-10 502 priv->mci = mci;
d0742284ec6da1 Qiuxu Zhuo 2025-03-10 503 priv->pdev = pdev;
d0742284ec6da1 Qiuxu Zhuo 2025-03-10 504 device_initialize(&priv->dev);
d0742284ec6da1 Qiuxu Zhuo 2025-03-10 505 /*
d0742284ec6da1 Qiuxu Zhuo 2025-03-10 506 * The EDAC core uses mci->pdev (pointer to the structure device)
d0742284ec6da1 Qiuxu Zhuo 2025-03-10 507 * as the memory controller ID. The SoCs attach one or more memory
d0742284ec6da1 Qiuxu Zhuo 2025-03-10 508 * controllers to a single pci_dev (a single pci_dev->dev can
d0742284ec6da1 Qiuxu Zhuo 2025-03-10 509 * correspond to multiple memory controllers).
d0742284ec6da1 Qiuxu Zhuo 2025-03-10 510 *
d0742284ec6da1 Qiuxu Zhuo 2025-03-10 511 * To make mci->pdev unique, assign pci_dev->dev to mci->pdev
d0742284ec6da1 Qiuxu Zhuo 2025-03-10 512 * for the first memory controller and assign a unique priv->dev
d0742284ec6da1 Qiuxu Zhuo 2025-03-10 513 * to mci->pdev for each additional memory controller.
d0742284ec6da1 Qiuxu Zhuo 2025-03-10 514 */
d0742284ec6da1 Qiuxu Zhuo 2025-03-10 515 mci->pdev = mc ? &priv->dev : &pdev->dev;
7ee40b897d18ab Jason Baron 2014-07-04 516
d0742284ec6da1 Qiuxu Zhuo 2025-03-10 517 ie31200_get_dimm_config(mci, window, cfg, mc);
7ee40b897d18ab Jason Baron 2014-07-04 518 ie31200_clear_error_info(mci);
7ee40b897d18ab Jason Baron 2014-07-04 519
7ee40b897d18ab Jason Baron 2014-07-04 520 if (edac_mc_add_mc(mci)) {
7ee40b897d18ab Jason Baron 2014-07-04 521 edac_dbg(3, "MC: failed edac_mc_add_mc()\n");
78fd4d1242e88f Jason Baron 2014-07-09 522 ret = -ENODEV;
78fd4d1242e88f Jason Baron 2014-07-09 523 goto fail_unmap;
7ee40b897d18ab Jason Baron 2014-07-04 524 }
7ee40b897d18ab Jason Baron 2014-07-04 525
d0742284ec6da1 Qiuxu Zhuo 2025-03-10 526 ie31200_pvt.priv[mc] = priv;
7ee40b897d18ab Jason Baron 2014-07-04 527 return 0;
7ee40b897d18ab Jason Baron 2014-07-04 528 fail_unmap:
7ee40b897d18ab Jason Baron 2014-07-04 529 iounmap(window);
78fd4d1242e88f Jason Baron 2014-07-09 530 fail_free:
329c40e0a4c7b0 Ma Ke 2025-11-05 531 put_device(&priv->dev);
78fd4d1242e88f Jason Baron 2014-07-09 532 edac_mc_free(mci);
498550e1fa7c1c Qiuxu Zhuo 2025-03-10 533 return ret;
498550e1fa7c1c Qiuxu Zhuo 2025-03-10 534 }
78fd4d1242e88f Jason Baron 2014-07-09 535
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 2+ messages in thread