drivers/edac/cpc925_edac.c:314:40: sparse: sparse: incorrect type in argument 1 (different base types)

From: kernel test robot
Date: Wed Dec 13 2023 - 20:57:27 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 5bd7ef53ffe5ca580e93e74eb8c81ed191ddc4bd
commit: e3c4ff6d8c949fa9a9ea1bd005bf1967efe09d5d EDAC: Remove EDAC_MM_EDAC
date: 7 years ago
config: powerpc64-randconfig-r113-20231118 (https://download.01.org/0day-ci/archive/20231214/202312140910.pdMaZpsA-lkp@xxxxxxxxx/config)
compiler: powerpc64-linux-gcc (GCC) 13.2.0
reproduce: (https://download.01.org/0day-ci/archive/20231214/202312140910.pdMaZpsA-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202312140910.pdMaZpsA-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
>> drivers/edac/cpc925_edac.c:314:40: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected restricted __be32 const [usertype] *cell @@ got unsigned int const *[assigned] reg @@
drivers/edac/cpc925_edac.c:314:40: sparse: expected restricted __be32 const [usertype] *cell
drivers/edac/cpc925_edac.c:314:40: sparse: got unsigned int const *[assigned] reg
drivers/edac/cpc925_edac.c:316:39: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected restricted __be32 const [usertype] *cell @@ got unsigned int const *[assigned] reg @@
drivers/edac/cpc925_edac.c:316:39: sparse: expected restricted __be32 const [usertype] *cell
drivers/edac/cpc925_edac.c:316:39: sparse: got unsigned int const *[assigned] reg
In file included from drivers/edac/cpc925_edac.c:22:
include/linux/module.h:131:13: warning: 'init_module' specifies less restrictive attribute than its target 'cpc925_edac_init': 'cold' [-Wmissing-attributes]
131 | int init_module(void) __attribute__((alias(#initfn)));
| ^~~~~~~~~~~
drivers/edac/cpc925_edac.c:1091:1: note: in expansion of macro 'module_init'
1091 | module_init(cpc925_edac_init);
| ^~~~~~~~~~~
drivers/edac/cpc925_edac.c:1067:19: note: 'init_module' target declared here
1067 | static int __init cpc925_edac_init(void)
| ^~~~~~~~~~~~~~~~
include/linux/module.h:137:14: warning: 'cleanup_module' specifies less restrictive attribute than its target 'cpc925_edac_exit': 'cold' [-Wmissing-attributes]
137 | void cleanup_module(void) __attribute__((alias(#exitfn)));
| ^~~~~~~~~~~~~~
drivers/edac/cpc925_edac.c:1092:1: note: in expansion of macro 'module_exit'
1092 | module_exit(cpc925_edac_exit);
| ^~~~~~~~~~~
drivers/edac/cpc925_edac.c:1086:20: note: 'cleanup_module' target declared here
1086 | static void __exit cpc925_edac_exit(void)
| ^~~~~~~~~~~~~~~~

vim +314 drivers/edac/cpc925_edac.c

2a9036afffb3a17 Harry Ciao 2009-06-17 294
2a9036afffb3a17 Harry Ciao 2009-06-17 295 /* Get total memory size from Open Firmware DTB */
2a9036afffb3a17 Harry Ciao 2009-06-17 296 static void get_total_mem(struct cpc925_mc_pdata *pdata)
2a9036afffb3a17 Harry Ciao 2009-06-17 297 {
2a9036afffb3a17 Harry Ciao 2009-06-17 298 struct device_node *np = NULL;
2a9036afffb3a17 Harry Ciao 2009-06-17 299 const unsigned int *reg, *reg_end;
2a9036afffb3a17 Harry Ciao 2009-06-17 300 int len, sw, aw;
2a9036afffb3a17 Harry Ciao 2009-06-17 301 unsigned long start, size;
2a9036afffb3a17 Harry Ciao 2009-06-17 302
2a9036afffb3a17 Harry Ciao 2009-06-17 303 np = of_find_node_by_type(NULL, "memory");
2a9036afffb3a17 Harry Ciao 2009-06-17 304 if (!np)
2a9036afffb3a17 Harry Ciao 2009-06-17 305 return;
2a9036afffb3a17 Harry Ciao 2009-06-17 306
2a9036afffb3a17 Harry Ciao 2009-06-17 307 aw = of_n_addr_cells(np);
2a9036afffb3a17 Harry Ciao 2009-06-17 308 sw = of_n_size_cells(np);
2a9036afffb3a17 Harry Ciao 2009-06-17 309 reg = (const unsigned int *)of_get_property(np, "reg", &len);
2a9036afffb3a17 Harry Ciao 2009-06-17 310 reg_end = reg + len/4;
2a9036afffb3a17 Harry Ciao 2009-06-17 311
2a9036afffb3a17 Harry Ciao 2009-06-17 312 pdata->total_mem = 0;
2a9036afffb3a17 Harry Ciao 2009-06-17 313 do {
2a9036afffb3a17 Harry Ciao 2009-06-17 @314 start = of_read_number(reg, aw);
2a9036afffb3a17 Harry Ciao 2009-06-17 315 reg += aw;
2a9036afffb3a17 Harry Ciao 2009-06-17 316 size = of_read_number(reg, sw);
2a9036afffb3a17 Harry Ciao 2009-06-17 317 reg += sw;
956b9ba156dbfdb Joe Perches 2012-04-29 318 edac_dbg(1, "start 0x%lx, size 0x%lx\n", start, size);
2a9036afffb3a17 Harry Ciao 2009-06-17 319 pdata->total_mem += size;
2a9036afffb3a17 Harry Ciao 2009-06-17 320 } while (reg < reg_end);
2a9036afffb3a17 Harry Ciao 2009-06-17 321
2a9036afffb3a17 Harry Ciao 2009-06-17 322 of_node_put(np);
956b9ba156dbfdb Joe Perches 2012-04-29 323 edac_dbg(0, "total_mem 0x%lx\n", pdata->total_mem);
2a9036afffb3a17 Harry Ciao 2009-06-17 324 }
2a9036afffb3a17 Harry Ciao 2009-06-17 325

:::::: The code at line 314 was first introduced by commit
:::::: 2a9036afffb3a174e980f90eb507c5aea6b540f6 edac: add CPC925 Memory Controller driver

:::::: TO: Harry Ciao <qingtao.cao@xxxxxxxxxxxxx>
:::::: CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>

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