mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Mark Brown <broonie@kernel.org>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: drivers/base/regmap/regmap-kunit.c:795:43: sparse: sparse: cast to restricted __le16
Date: Mon, 11 Sep 2023 04:54:58 +0800	[thread overview]
Message-ID: <202309110407.qVp0e60U-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   e56b2b6057996c5f48da518c79d6590f8bfaabf3
commit: 155a6bd6375b584c8bdbf963b8ddef672ff9aca3 regmap: Provide basic KUnit coverage for the raw register I/O
date:   3 months ago
config: i386-randconfig-063-20230910 (https://download.01.org/0day-ci/archive/20230911/202309110407.qVp0e60U-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230911/202309110407.qVp0e60U-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/202309110407.qVp0e60U-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> drivers/base/regmap/regmap-kunit.c:795:43: sparse: sparse: cast to restricted __le16
>> drivers/base/regmap/regmap-kunit.c:798:43: sparse: sparse: cast to restricted __be16
   drivers/base/regmap/regmap-kunit.c:875:25: sparse: sparse: cast to restricted __be16
   drivers/base/regmap/regmap-kunit.c:875:25: sparse: sparse: cast to restricted __be16
   drivers/base/regmap/regmap-kunit.c:877:25: sparse: sparse: cast to restricted __le16
   drivers/base/regmap/regmap-kunit.c:877:25: sparse: sparse: cast to restricted __le16
   drivers/base/regmap/regmap-kunit.c:944:33: sparse: sparse: cast to restricted __be16
   drivers/base/regmap/regmap-kunit.c:944:33: sparse: sparse: cast to restricted __be16
   drivers/base/regmap/regmap-kunit.c:947:33: sparse: sparse: cast to restricted __le16
   drivers/base/regmap/regmap-kunit.c:947:33: sparse: sparse: cast to restricted __le16
   drivers/base/regmap/regmap-kunit.c:989:17: sparse: sparse: cast to restricted __be16
   drivers/base/regmap/regmap-kunit.c:989:17: sparse: sparse: cast to restricted __be16
   drivers/base/regmap/regmap-kunit.c:992:17: sparse: sparse: cast to restricted __le16
   drivers/base/regmap/regmap-kunit.c:992:17: sparse: sparse: cast to restricted __le16
   drivers/base/regmap/regmap-kunit.c:1004:33: sparse: sparse: cast to restricted __be16
   drivers/base/regmap/regmap-kunit.c:1004:33: sparse: sparse: cast to restricted __be16
   drivers/base/regmap/regmap-kunit.c:1007:33: sparse: sparse: cast to restricted __le16
   drivers/base/regmap/regmap-kunit.c:1007:33: sparse: sparse: cast to restricted __le16

vim +795 drivers/base/regmap/regmap-kunit.c

   758	
   759	static struct regmap *gen_raw_regmap(struct regmap_config *config,
   760					     struct raw_test_types *test_type,
   761					     struct regmap_ram_data **data)
   762	{
   763		u16 *buf;
   764		struct regmap *ret;
   765		size_t size = (config->max_register + 1) * config->reg_bits / 8;
   766		int i;
   767		struct reg_default *defaults;
   768	
   769		config->cache_type = test_type->cache_type;
   770		config->val_format_endian = test_type->val_endian;
   771	
   772		buf = kmalloc(size, GFP_KERNEL);
   773		if (!buf)
   774			return ERR_PTR(-ENOMEM);
   775	
   776		get_random_bytes(buf, size);
   777	
   778		*data = kzalloc(sizeof(**data), GFP_KERNEL);
   779		if (!(*data))
   780			return ERR_PTR(-ENOMEM);
   781		(*data)->vals = (void *)buf;
   782	
   783		config->num_reg_defaults = config->max_register + 1;
   784		defaults = kcalloc(config->num_reg_defaults,
   785				   sizeof(struct reg_default),
   786				   GFP_KERNEL);
   787		if (!defaults)
   788			return ERR_PTR(-ENOMEM);
   789		config->reg_defaults = defaults;
   790	
   791		for (i = 0; i < config->num_reg_defaults; i++) {
   792			defaults[i].reg = i;
   793			switch (test_type->val_endian) {
   794			case REGMAP_ENDIAN_LITTLE:
 > 795				defaults[i].def = le16_to_cpu(buf[i]);
   796				break;
   797			case REGMAP_ENDIAN_BIG:
 > 798				defaults[i].def = be16_to_cpu(buf[i]);
   799				break;
   800			default:
   801				return ERR_PTR(-EINVAL);
   802			}
   803		}
   804	
   805		/*
   806		 * We use the defaults in the tests but they don't make sense
   807		 * to the core if there's no cache.
   808		 */
   809		if (config->cache_type == REGCACHE_NONE)
   810			config->num_reg_defaults = 0;
   811	
   812		ret = regmap_init_raw_ram(config, *data);
   813		if (IS_ERR(ret)) {
   814			kfree(buf);
   815			kfree(*data);
   816		}
   817	
   818		return ret;
   819	}
   820	

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

             reply	other threads:[~2023-09-10 20:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-10 20:54 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-01-11 21:20 kernel test robot
2023-08-24  4:56 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=202309110407.qVp0e60U-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=broonie@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®