CC: [email protected]
BCC: [email protected]
CC: Alison Schofield <[email protected]>
CC: Vishal Verma <[email protected]>
CC: Ira Weiny <[email protected]>
CC: Ben Widawsky <[email protected]>
CC: Dan Williams <[email protected]>
TO: Dan Williams <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl.git preview
head:   1985cf58850562e4b960e19d46f0d8f19d6c7cbd
commit: 00f2da5084b78ec176b8bff9d22e3bf6a0e5a821 [42/51] cxl/region: Allocate 
host physical address (HPA) capacity to new regions
:::::: branch date: 10 days ago
:::::: commit date: 10 days ago
config: i386-randconfig-m021-20220704 
(https://download.01.org/0day-ci/archive/20220705/[email protected]/config)
compiler: gcc-11 (Debian 11.3.0-3) 11.3.0

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <[email protected]>
Reported-by: Dan Carpenter <[email protected]>

New smatch warnings:
drivers/cxl/core/region.c:274 alloc_hpa() error: uninitialized symbol 'res'.

Old smatch warnings:
drivers/cxl/core/region.c:541 create_pmem_region_store() warn: unsigned 'rc' is 
never less than zero.

vim +/res +274 drivers/cxl/core/region.c

00f2da5084b78e Dan Williams 2022-04-25  263  
00f2da5084b78e Dan Williams 2022-04-25  264  static int alloc_hpa(struct 
cxl_region *cxlr, resource_size_t size)
00f2da5084b78e Dan Williams 2022-04-25  265  {
00f2da5084b78e Dan Williams 2022-04-25  266     struct cxl_root_decoder *cxlrd 
= to_cxl_root_decoder(cxlr->dev.parent);
00f2da5084b78e Dan Williams 2022-04-25  267     struct cxl_region_params *p = 
&cxlr->params;
00f2da5084b78e Dan Williams 2022-04-25  268     struct resource *res;
00f2da5084b78e Dan Williams 2022-04-25  269     u32 remainder = 0;
00f2da5084b78e Dan Williams 2022-04-25  270  
00f2da5084b78e Dan Williams 2022-04-25  271     
lockdep_assert_held_write(&cxl_region_rwsem);
00f2da5084b78e Dan Williams 2022-04-25  272  
00f2da5084b78e Dan Williams 2022-04-25  273     /* Nothing to do... */
00f2da5084b78e Dan Williams 2022-04-25 @274     if (p->res && 
resource_size(res) == size)
00f2da5084b78e Dan Williams 2022-04-25  275             return 0;
00f2da5084b78e Dan Williams 2022-04-25  276  
00f2da5084b78e Dan Williams 2022-04-25  277     /* To change size the old size 
must be freed first */
00f2da5084b78e Dan Williams 2022-04-25  278     if (p->res)
00f2da5084b78e Dan Williams 2022-04-25  279             return -EBUSY;
00f2da5084b78e Dan Williams 2022-04-25  280  
00f2da5084b78e Dan Williams 2022-04-25  281     if (p->state >= 
CXL_CONFIG_INTERLEAVE_ACTIVE)
00f2da5084b78e Dan Williams 2022-04-25  282             return -EBUSY;
00f2da5084b78e Dan Williams 2022-04-25  283  
00f2da5084b78e Dan Williams 2022-04-25  284     if (!p->interleave_ways || 
!p->interleave_granularity)
00f2da5084b78e Dan Williams 2022-04-25  285             return -ENXIO;
00f2da5084b78e Dan Williams 2022-04-25  286  
00f2da5084b78e Dan Williams 2022-04-25  287     div_u64_rem(size, SZ_256M * 
p->interleave_ways, &remainder);
00f2da5084b78e Dan Williams 2022-04-25  288     if (remainder)
00f2da5084b78e Dan Williams 2022-04-25  289             return -EINVAL;
00f2da5084b78e Dan Williams 2022-04-25  290  
00f2da5084b78e Dan Williams 2022-04-25  291     res = 
alloc_free_mem_region(cxlrd->res, size, SZ_256M,
00f2da5084b78e Dan Williams 2022-04-25  292                                 
dev_name(&cxlr->dev));
00f2da5084b78e Dan Williams 2022-04-25  293     if (IS_ERR(res)) {
00f2da5084b78e Dan Williams 2022-04-25  294             dev_dbg(&cxlr->dev, 
"failed to allocate HPA: %ld\n",
00f2da5084b78e Dan Williams 2022-04-25  295                     PTR_ERR(res));
00f2da5084b78e Dan Williams 2022-04-25  296             return PTR_ERR(res);
00f2da5084b78e Dan Williams 2022-04-25  297     }
00f2da5084b78e Dan Williams 2022-04-25  298  
00f2da5084b78e Dan Williams 2022-04-25  299     p->res = res;
00f2da5084b78e Dan Williams 2022-04-25  300     p->state = 
CXL_CONFIG_INTERLEAVE_ACTIVE;
00f2da5084b78e Dan Williams 2022-04-25  301  
00f2da5084b78e Dan Williams 2022-04-25  302     return 0;
00f2da5084b78e Dan Williams 2022-04-25  303  }
00f2da5084b78e Dan Williams 2022-04-25  304  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp
_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to