arch/powerpc/kernel/prom_init.c:2897:22: sparse: sparse: incorrect type in initializer (different base types)

From: kernel test robot
Date: Sun Dec 08 2024 - 23:02:13 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: b5f217084ab3ddd4bdd03cd437f8e3b7e2d1f5b6
commit: cf89c9434af122f28a3552e6f9cc5158c33ce50a powerpc/prom_init: Fixup missing powermac #size-cells
date: 10 days ago
config: powerpc64-randconfig-r113-20241207 (https://download.01.org/0day-ci/archive/20241207/202412071026.URGzioD6-lkp@xxxxxxxxx/config)
compiler: powerpc64-linux-gcc (GCC) 14.2.0
reproduce: (https://download.01.org/0day-ci/archive/20241207/202412071026.URGzioD6-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/202412071026.URGzioD6-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
>> arch/powerpc/kernel/prom_init.c:2897:22: sparse: sparse: incorrect type in initializer (different base types) @@ expected restricted __be32 [usertype] val @@ got int @@
arch/powerpc/kernel/prom_init.c:2897:22: sparse: expected restricted __be32 [usertype] val
arch/powerpc/kernel/prom_init.c:2897:22: sparse: got int

vim +2897 arch/powerpc/kernel/prom_init.c

2893
2894 #ifdef CONFIG_PPC_PMAC
2895 static void __init fixup_device_tree_pmac(void)
2896 {
> 2897 __be32 val = 1;
2898 char type[8];
2899 phandle node;
2900
2901 // Some pmacs are missing #size-cells on escc nodes
2902 for (node = 0; prom_next_node(&node); ) {
2903 type[0] = '\0';
2904 prom_getprop(node, "device_type", type, sizeof(type));
2905 if (prom_strcmp(type, "escc"))
2906 continue;
2907
2908 if (prom_getproplen(node, "#size-cells") != PROM_ERROR)
2909 continue;
2910
2911 prom_setprop(node, NULL, "#size-cells", &val, sizeof(val));
2912 }
2913 }
2914 #else
2915 static inline void fixup_device_tree_pmac(void) { }
2916 #endif
2917

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