Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Ma Ke <make24@iscas.ac.cn>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev
Subject: Re: [PATCH v2] EDAC/ie31200: Fix error handling in ie31200_register_mci
Date: Thu, 6 Nov 2025 04:55:26 +0800	[thread overview]
Message-ID: <202511060427.k5gEuYdp-lkp@intel.com> (raw)
In-Reply-To: <20251105022146.22105-1-make24@iscas.ac.cn>

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

       reply	other threads:[~2025-11-05 20:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20251105022146.22105-1-make24@iscas.ac.cn>
2025-11-05 20:55 ` kernel test robot [this message]
2025-11-07 16:18   ` [PATCH v2] EDAC/ie31200: Fix error handling in ie31200_register_mci Breno Leitao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202511060427.k5gEuYdp-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=llvm@lists.linux.dev \
    --cc=make24@iscas.ac.cn \
    --cc=oe-kbuild-all@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox