Re: [PATCH V4 XRT Alveo Infrastructure 3/5] of: create empty of root

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Lizhi,

I love your patch! Perhaps something to improve:

[auto build test WARNING on robh/for-next]
[also build test WARNING on linux/master linus/master v5.16-rc8 next-20220107]
[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]

url:    https://github.com/0day-ci/linux/commits/Lizhi-Hou/XRT-Alveo-driver-infrastructure-overview/20220106-065312
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: i386-randconfig-m021-20220105 (https://download.01.org/0day-ci/archive/20220108/202201081100.CZieN1nu-lkp@xxxxxxxxx/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

New smatch warnings:
drivers/of/fdt.c:541 of_fdt_root_init() warn: inconsistent indenting

Old smatch warnings:
drivers/of/fdt.c:1313 early_init_dt_add_memory_arch() warn: unsigned 'base + size' is never less than zero.
drivers/of/fdt.c:1318 early_init_dt_add_memory_arch() warn: unsigned 'base' is never less than zero.
drivers/of/fdt.c:1428 unflatten_and_copy_device_tree() warn: should '1 << (((__builtin_constant_p((((((7 * 4) + 4) + 4) + 4)) - 1)) ?((((((((7 * 4) + 4) + 4) + 4)) - 1) < 2) ?0:63 - __builtin_clzll((((((7 * 4) + 4) + 4) + 4)) - 1)):((4 <= 4)) ?__ilog2_u32((((((7 * 4) + 4) + 4) + 4)) - 1):__ilog2_u64((((((7 * 4) + 4) + 4) + 4)) - 1)) + 1)' be a 64 bit type?

vim +541 drivers/of/fdt.c

   468	
   469	static int __init of_fdt_root_init(void)
   470	{
   471		struct device_node *dt = NULL, *np;
   472		void *fdt = NULL, *fdt_aligned;
   473		struct property *prop = NULL;
   474		__be32 *val = NULL;
   475		int size, rc = 0;
   476	
   477	#if !defined(CONFIG_OF_UNITTEST)
   478		if (of_root)
   479			return 0;
   480	#endif
   481		size = __dtb_fdt_default_end - __dtb_fdt_default_begin;
   482	
   483		fdt = kmalloc(size + FDT_ALIGN_SIZE, GFP_KERNEL);
   484		if (!fdt)
   485			return -ENOMEM;
   486	
   487		fdt_aligned = PTR_ALIGN(fdt, FDT_ALIGN_SIZE);
   488		memcpy(fdt_aligned, __dtb_fdt_default_begin, size);
   489	
   490		if (!of_fdt_unflatten_tree((const unsigned long *)fdt_aligned,
   491					   NULL, &dt)) {
   492			pr_warn("%s: unflatten default tree failed\n", __func__);
   493			kfree(fdt);
   494			return -ENODATA;
   495		}
   496		if (!dt) {
   497			pr_warn("%s: empty default tree\n", __func__);
   498			kfree(fdt);
   499			return -ENODATA;
   500		}
   501	
   502		/*
   503		 * This lock normally encloses of_resolve_phandles()
   504		 */
   505		of_overlay_mutex_lock();
   506	
   507		rc = of_resolve_phandles(dt);
   508		if (rc) {
   509			pr_err("%s: Failed to resolve phandles (rc=%i)\n", __func__, rc);
   510			goto failed;
   511		}
   512	
   513		if (!of_root) {
   514			prop = kcalloc(2, sizeof(*prop), GFP_KERNEL);
   515			if (!prop) {
   516				rc = -ENOMEM;
   517				goto failed;
   518			}
   519			val = kzalloc(sizeof(*val), GFP_KERNEL);
   520			if (!val) {
   521				rc = -ENOMEM;
   522				goto failed;
   523			}
   524			*val = cpu_to_be32(sizeof(void *) / sizeof(u32));
   525	
   526			prop->name = "#address-cells";
   527			prop->value = val;
   528			prop->length = sizeof(u32);
   529			of_add_property(dt, prop);
   530			prop++;
   531			prop->name = "#size-cells";
   532			prop->value = val;
   533			prop->length = sizeof(u32);
   534			of_add_property(dt, prop);
   535			of_root = dt;
   536			for_each_of_allnodes(np)
   537				__of_attach_node_sysfs(np);
   538			of_aliases = of_find_node_by_path("/aliases");
   539			of_chosen = of_find_node_by_path("/chosen");
   540			of_overlay_mutex_unlock();
 > 541	pr_info("OF ROOT FLAG %lx\n", of_root->_flags);
   542			return 0;
   543		}
   544	
   545		unittest_data_add(dt);
   546	
   547		of_overlay_mutex_unlock();
   548	
   549		return 0;
   550	
   551	failed:
   552		of_overlay_mutex_unlock();
   553		kfree(val);
   554		kfree(prop);
   555		return rc;
   556	}
   557	pure_initcall(of_fdt_root_init);
   558	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux