[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202308241229.nFg96Evs-lkp@intel.com>
Date: Thu, 24 Aug 2023 12:56:29 +0800
From: kernel test robot <lkp@...el.com>
To: Mark Brown <broonie@...nel.org>
Cc: oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: drivers/base/regmap/regmap-kunit.c:795:43: sparse: sparse: cast to
restricted __le16
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 93f5de5f648d2b1ce3540a4ac71756d4a852dc23
commit: 155a6bd6375b584c8bdbf963b8ddef672ff9aca3 regmap: Provide basic KUnit coverage for the raw register I/O
date: 2 months ago
config: i386-randconfig-061-20230823 (https://download.01.org/0day-ci/archive/20230824/202308241229.nFg96Evs-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce: (https://download.01.org/0day-ci/archive/20230824/202308241229.nFg96Evs-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@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202308241229.nFg96Evs-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
Powered by blists - more mailing lists