[asahilinux:bits/110-smc 4/17] drivers/platform/apple/smc_core.c:210:26: sparse: sparse: cast to restricted __be32
From: kernel test robot
Date: Sun Jul 31 2022 - 11:11:06 EST
tree: https://github.com/AsahiLinux/linux bits/110-smc
head: b1ba46a24716bd39ca22059fc93705a727c39890
commit: 58a839ca536e6de7bf1b2dff7441509c3ac9c8e7 [4/17] platform/apple: Add new Apple Mac SMC driver
config: arm64-randconfig-s043-20220721 (https://download.01.org/0day-ci/archive/20220731/202207312332.oiwfkI9y-lkp@xxxxxxxxx/config)
compiler: aarch64-linux-gcc (GCC) 12.1.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-39-gce1a6720-dirty
# https://github.com/AsahiLinux/linux/commit/58a839ca536e6de7bf1b2dff7441509c3ac9c8e7
git remote add asahilinux https://github.com/AsahiLinux/linux
git fetch --no-tags asahilinux bits/110-smc
git checkout 58a839ca536e6de7bf1b2dff7441509c3ac9c8e7
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=arm64 SHELL=/bin/bash drivers/platform/apple/ sound/soc/
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>
sparse warnings: (new ones prefixed by >>)
>> drivers/platform/apple/smc_core.c:210:26: sparse: sparse: cast to restricted __be32
>> drivers/platform/apple/smc_core.c:210:26: sparse: sparse: cast to restricted __be32
>> drivers/platform/apple/smc_core.c:210:26: sparse: sparse: cast to restricted __be32
>> drivers/platform/apple/smc_core.c:210:26: sparse: sparse: cast to restricted __be32
>> drivers/platform/apple/smc_core.c:210:26: sparse: sparse: cast to restricted __be32
>> drivers/platform/apple/smc_core.c:210:26: sparse: sparse: cast to restricted __be32
vim +210 drivers/platform/apple/smc_core.c
190
191 struct apple_smc *apple_smc_probe(struct device *dev, const struct apple_smc_backend_ops *ops, void *cookie)
192 {
193 struct apple_smc *smc;
194 u32 count;
195 int ret;
196
197 smc = devm_kzalloc(dev, sizeof(*smc), GFP_KERNEL);
198 if (!smc)
199 return ERR_PTR(-ENOMEM);
200
201 smc->dev = dev;
202 smc->be_cookie = cookie;
203 smc->be = ops;
204 mutex_init(&smc->mutex);
205 BLOCKING_INIT_NOTIFIER_HEAD(&smc->event_handlers);
206
207 ret = apple_smc_read_u32(smc, SMC_KEY(#KEY), &count);
208 if (ret)
209 return ERR_PTR(dev_err_probe(dev, ret, "Failed to get key count"));
> 210 smc->key_count = be32_to_cpu(count);
211
212 ret = apple_smc_get_key_by_index(smc, 0, &smc->first_key);
213 if (ret)
214 return ERR_PTR(dev_err_probe(dev, ret, "Failed to get first key"));
215
216 ret = apple_smc_get_key_by_index(smc, smc->key_count - 1, &smc->last_key);
217 if (ret)
218 return ERR_PTR(dev_err_probe(dev, ret, "Failed to get last key"));
219
220 /* Enable notifications */
221 apple_smc_write_flag(smc, SMC_KEY(NTAP), 1);
222
223 dev_info(dev, "Initialized (%d keys %p4ch..%p4ch)\n",
224 smc->key_count, &smc->first_key, &smc->last_key);
225
226 dev_set_drvdata(dev, smc);
227
228 ret = mfd_add_devices(dev, -1, apple_smc_devs, ARRAY_SIZE(apple_smc_devs), NULL, 0, NULL);
229 if (ret)
230 return ERR_PTR(dev_err_probe(dev, ret, "Subdevice initialization failed"));
231
232 return smc;
233 }
234 EXPORT_SYMBOL(apple_smc_probe);
235
--
0-DAY CI Kernel Test Service
https://01.org/lkp