All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
Cc: oe-kbuild-all@lists.linux.dev
Subject: [intel-lts:4.19/android_t 13367/30000] drivers/of/irq.c:284:73: sparse: sparse: incorrect type in initializer (different base types)
Date: Sun, 15 Oct 2023 00:13:48 +0800	[thread overview]
Message-ID: <202310150009.fIktcysF-lkp@intel.com> (raw)

tree:   https://github.com/intel/linux-intel-lts.git 4.19/android_t
head:   247bc655e03e4ac3632b21081ca56b813a644dcf
commit: a323430753b95d8ac29fc0b3c2502b50f6073737 [13367/30000] ANDROID: GKI: of: irq: add helper to remap interrupts to another irqdomain
config: x86_64-randconfig-122-20230910 (https://download.01.org/0day-ci/archive/20231015/202310150009.fIktcysF-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-12) 11.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231015/202310150009.fIktcysF-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/202310150009.fIktcysF-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> drivers/of/irq.c:284:73: sparse: sparse: incorrect type in initializer (different base types) @@     expected restricted __be32 @@     got int @@
   drivers/of/irq.c:284:73: sparse:     expected restricted __be32
   drivers/of/irq.c:284:73: sparse:     got int

vim +284 drivers/of/irq.c

   276	
   277	int of_irq_domain_map(const struct irq_fwspec *in, struct irq_fwspec *out)
   278	{
   279		char *stem_name;
   280		char *cells_name, *map_name = NULL, *mask_name = NULL;
   281		char *pass_name = NULL;
   282		struct device_node *cur, *new = NULL;
   283		const __be32 *map, *mask, *pass;
 > 284		static const __be32 dummy_mask[] = { [0 ... MAX_PHANDLE_ARGS] = ~0 };
   285		static const __be32 dummy_pass[] = { [0 ... MAX_PHANDLE_ARGS] = 0 };
   286		__be32 initial_match_array[MAX_PHANDLE_ARGS];
   287		const __be32 *match_array = initial_match_array;
   288		int i, ret, map_len, match;
   289		u32 in_size, out_size;
   290	
   291		stem_name = "";
   292		cells_name = "#interrupt-cells";
   293	
   294		ret = -ENOMEM;
   295		map_name = kasprintf(GFP_KERNEL, "irqdomain%s-map", stem_name);
   296		if (!map_name)
   297			goto free;
   298	
   299		mask_name = kasprintf(GFP_KERNEL, "irqdomain%s-map-mask", stem_name);
   300		if (!mask_name)
   301			goto free;
   302	
   303		pass_name = kasprintf(GFP_KERNEL, "irqdomain%s-map-pass-thru", stem_name);
   304		if (!pass_name)
   305			goto free;
   306	
   307		/* Get the #interrupt-cells property */
   308		cur = to_of_node(in->fwnode);
   309		ret = of_property_read_u32(cur, cells_name, &in_size);
   310		if (ret < 0)
   311			goto put;
   312	
   313		/* Precalculate the match array - this simplifies match loop */
   314		for (i = 0; i < in_size; i++)
   315			initial_match_array[i] = cpu_to_be32(in->param[i]);
   316	
   317		ret = -EINVAL;
   318		/* Get the irqdomain-map property */
   319		map = of_get_property(cur, map_name, &map_len);
   320		if (!map) {
   321			ret = 0;
   322			goto free;
   323		}
   324		map_len /= sizeof(u32);
   325	
   326		/* Get the irqdomain-map-mask property (optional) */
   327		mask = of_get_property(cur, mask_name, NULL);
   328		if (!mask)
   329			mask = dummy_mask;
   330		/* Iterate through irqdomain-map property */
   331		match = 0;
   332		while (map_len > (in_size + 1) && !match) {
   333			/* Compare specifiers */
   334			match = 1;
   335			for (i = 0; i < in_size; i++, map_len--)
   336				match &= !((match_array[i] ^ *map++) & mask[i]);
   337	
   338			of_node_put(new);
   339			new = of_find_node_by_phandle(be32_to_cpup(map));
   340			map++;
   341			map_len--;
   342	
   343			/* Check if not found */
   344			if (!new)
   345				goto put;
   346	
   347			if (!of_device_is_available(new))
   348				match = 0;
   349	
   350			ret = of_property_read_u32(new, cells_name, &out_size);
   351			if (ret)
   352				goto put;
   353	
   354			/* Check for malformed properties */
   355			if (WARN_ON(out_size > MAX_PHANDLE_ARGS))
   356				goto put;
   357			if (map_len < out_size)
   358				goto put;
   359	
   360			/* Move forward by new node's #interrupt-cells amount */
   361			map += out_size;
   362			map_len -= out_size;
   363		}
   364		if (match) {
   365			/* Get the irqdomain-map-pass-thru property (optional) */
   366			pass = of_get_property(cur, pass_name, NULL);
   367			if (!pass)
   368				pass = dummy_pass;
   369	
   370			/*
   371			 * Successfully parsed a irqdomain-map translation; copy new
   372			 * specifier into the out structure, keeping the
   373			 * bits specified in irqdomain-map-pass-thru.
   374			 */
   375			match_array = map - out_size;
   376			for (i = 0; i < out_size; i++) {
   377				__be32 val = *(map - out_size + i);
   378	
   379				out->param[i] = in->param[i];
   380				if (i < in_size) {
   381					val &= ~pass[i];
   382					val |= cpu_to_be32(out->param[i]) & pass[i];
   383				}
   384	
   385				out->param[i] = be32_to_cpu(val);
   386			}
   387			out->param_count = in_size = out_size;
   388			out->fwnode = of_node_to_fwnode(new);
   389		}
   390	put:
   391		of_node_put(cur);
   392		of_node_put(new);
   393	free:
   394		kfree(mask_name);
   395		kfree(map_name);
   396		kfree(pass_name);
   397	
   398		return ret;
   399	}
   400	EXPORT_SYMBOL(of_irq_domain_map);
   401	

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

             reply	other threads:[~2023-10-14 16:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-14 16:13 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-11-11 15:51 [intel-lts:4.19/android_t 13367/30000] drivers/of/irq.c:284:73: sparse: sparse: incorrect type in initializer (different base types) kernel test robot

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=202310150009.fIktcysF-lkp@intel.com \
    --to=lkp@intel.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.