mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* drivers/mfd/macsmc.c:462:26: sparse: sparse: cast to restricted __be32
@ 2026-06-11 14:50 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2026-06-11 14:50 UTC (permalink / raw)
  To: Sven Peter
  Cc: oe-kbuild-all, linux-kernel, Lee Jones, Hector Martin,
	Alyssa Rosenzweig, Neal Gompa

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   9716c086c8e8b141d35aa61f2e96a2e83de212a7
commit: e038d985c9823a12cd64fa077d0c5aca2c644b67 mfd: Add Apple Silicon System Management Controller
date:   11 months ago
config: riscv-randconfig-r121-20260611 (https://download.01.org/0day-ci/archive/20260611/202606112222.NIgwfLNG-lkp@intel.com/config)
compiler: riscv64-linux-gcc (GCC) 8.5.0
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260611/202606112222.NIgwfLNG-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
| Fixes: e038d985c982 ("mfd: Add Apple Silicon System Management Controller")
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202606112222.NIgwfLNG-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> drivers/mfd/macsmc.c:462:26: sparse: sparse: cast to restricted __be32
>> drivers/mfd/macsmc.c:462:26: sparse: sparse: cast to restricted __be32
>> drivers/mfd/macsmc.c:462:26: sparse: sparse: cast to restricted __be32
>> drivers/mfd/macsmc.c:462:26: sparse: sparse: cast to restricted __be32
>> drivers/mfd/macsmc.c:462:26: sparse: sparse: cast to restricted __be32
>> drivers/mfd/macsmc.c:462:26: sparse: sparse: cast to restricted __be32
   drivers/mfd/macsmc.c:242:5: sparse: sparse: context imbalance in 'apple_smc_write_atomic' - wrong count at exit

vim +462 drivers/mfd/macsmc.c

   404	
   405	static int apple_smc_probe(struct platform_device *pdev)
   406	{
   407		struct device *dev = &pdev->dev;
   408		struct apple_smc *smc;
   409		u32 count;
   410		int ret;
   411	
   412		smc = devm_kzalloc(dev, sizeof(*smc), GFP_KERNEL);
   413		if (!smc)
   414			return -ENOMEM;
   415	
   416		smc->dev = &pdev->dev;
   417		smc->sram_base = devm_platform_get_and_ioremap_resource(pdev, 1, &smc->sram);
   418		if (IS_ERR(smc->sram_base))
   419			return dev_err_probe(dev, PTR_ERR(smc->sram_base), "Failed to map SRAM region");
   420	
   421		smc->rtk = devm_apple_rtkit_init(dev, smc, NULL, 0, &apple_smc_rtkit_ops);
   422		if (IS_ERR(smc->rtk))
   423			return dev_err_probe(dev, PTR_ERR(smc->rtk), "Failed to initialize RTKit");
   424	
   425		smc->boot_stage = APPLE_SMC_BOOTING;
   426		ret = apple_rtkit_wake(smc->rtk);
   427		if (ret)
   428			return dev_err_probe(dev, ret, "Failed to wake up SMC");
   429	
   430		ret = devm_add_action_or_reset(dev, apple_smc_rtkit_shutdown, smc);
   431		if (ret)
   432			return dev_err_probe(dev, ret, "Failed to register rtkit shutdown action");
   433	
   434		ret = apple_rtkit_start_ep(smc->rtk, SMC_ENDPOINT);
   435		if (ret)
   436			return dev_err_probe(dev, ret, "Failed to start SMC endpoint");
   437	
   438		init_completion(&smc->init_done);
   439		init_completion(&smc->cmd_done);
   440	
   441		ret = apple_rtkit_send_message(smc->rtk, SMC_ENDPOINT,
   442					       FIELD_PREP(SMC_MSG, SMC_MSG_INITIALIZE), NULL, false);
   443		if (ret)
   444			return dev_err_probe(dev, ret, "Failed to send init message");
   445	
   446		if (wait_for_completion_timeout(&smc->init_done, msecs_to_jiffies(SMC_TIMEOUT_MS)) == 0) {
   447			dev_err(dev, "Timed out initializing SMC");
   448			return -ETIMEDOUT;
   449		}
   450	
   451		if (smc->boot_stage != APPLE_SMC_INITIALIZED) {
   452			dev_err(dev, "SMC failed to boot successfully, boot stage=%d\n", smc->boot_stage);
   453			return -EIO;
   454		}
   455	
   456		dev_set_drvdata(&pdev->dev, smc);
   457		BLOCKING_INIT_NOTIFIER_HEAD(&smc->event_handlers);
   458	
   459		ret = apple_smc_read_u32(smc, SMC_KEY(#KEY), &count);
   460		if (ret)
   461			return dev_err_probe(smc->dev, ret, "Failed to get key count");
 > 462		smc->key_count = be32_to_cpu(count);
   463	
   464		/* Enable notifications */
   465		apple_smc_write_flag(smc, SMC_KEY(NTAP), true);
   466		ret = devm_add_action_or_reset(dev, apple_smc_disable_notifications, smc);
   467		if (ret)
   468			return dev_err_probe(dev, ret, "Failed to register notification disable action");
   469	
   470		ret = devm_mfd_add_devices(smc->dev, PLATFORM_DEVID_NONE,
   471					   apple_smc_devs, ARRAY_SIZE(apple_smc_devs),
   472					   NULL, 0, NULL);
   473		if (ret)
   474			return dev_err_probe(smc->dev, ret, "Failed to register sub-devices");
   475	
   476	
   477		return 0;
   478	}
   479	

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* drivers/mfd/macsmc.c:462:26: sparse: sparse: cast to restricted __be32
@ 2026-07-18  2:48 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2026-07-18  2:48 UTC (permalink / raw)
  To: Sven Peter
  Cc: oe-kbuild-all, linux-kernel, Lee Jones, Hector Martin,
	Alyssa Rosenzweig, Neal Gompa

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   94515f3a7d4256a5062176b7d6ed0471938cd51a
commit: e038d985c9823a12cd64fa077d0c5aca2c644b67 mfd: Add Apple Silicon System Management Controller
date:   12 months ago
config: sparc64-randconfig-r131-20260716 (https://download.01.org/0day-ci/archive/20260718/202607181046.OANjIoqR-lkp@intel.com/config)
compiler: sparc64-linux-gcc (GCC) 13.4.0
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260718/202607181046.OANjIoqR-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
| Fixes: e038d985c982 ("mfd: Add Apple Silicon System Management Controller")
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202607181046.OANjIoqR-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> drivers/mfd/macsmc.c:462:26: sparse: sparse: cast to restricted __be32
   drivers/mfd/macsmc.c:242:5: sparse: sparse: context imbalance in 'apple_smc_write_atomic' - wrong count at exit

vim +462 drivers/mfd/macsmc.c

   404	
   405	static int apple_smc_probe(struct platform_device *pdev)
   406	{
   407		struct device *dev = &pdev->dev;
   408		struct apple_smc *smc;
   409		u32 count;
   410		int ret;
   411	
   412		smc = devm_kzalloc(dev, sizeof(*smc), GFP_KERNEL);
   413		if (!smc)
   414			return -ENOMEM;
   415	
   416		smc->dev = &pdev->dev;
   417		smc->sram_base = devm_platform_get_and_ioremap_resource(pdev, 1, &smc->sram);
   418		if (IS_ERR(smc->sram_base))
   419			return dev_err_probe(dev, PTR_ERR(smc->sram_base), "Failed to map SRAM region");
   420	
   421		smc->rtk = devm_apple_rtkit_init(dev, smc, NULL, 0, &apple_smc_rtkit_ops);
   422		if (IS_ERR(smc->rtk))
   423			return dev_err_probe(dev, PTR_ERR(smc->rtk), "Failed to initialize RTKit");
   424	
   425		smc->boot_stage = APPLE_SMC_BOOTING;
   426		ret = apple_rtkit_wake(smc->rtk);
   427		if (ret)
   428			return dev_err_probe(dev, ret, "Failed to wake up SMC");
   429	
   430		ret = devm_add_action_or_reset(dev, apple_smc_rtkit_shutdown, smc);
   431		if (ret)
   432			return dev_err_probe(dev, ret, "Failed to register rtkit shutdown action");
   433	
   434		ret = apple_rtkit_start_ep(smc->rtk, SMC_ENDPOINT);
   435		if (ret)
   436			return dev_err_probe(dev, ret, "Failed to start SMC endpoint");
   437	
   438		init_completion(&smc->init_done);
   439		init_completion(&smc->cmd_done);
   440	
   441		ret = apple_rtkit_send_message(smc->rtk, SMC_ENDPOINT,
   442					       FIELD_PREP(SMC_MSG, SMC_MSG_INITIALIZE), NULL, false);
   443		if (ret)
   444			return dev_err_probe(dev, ret, "Failed to send init message");
   445	
   446		if (wait_for_completion_timeout(&smc->init_done, msecs_to_jiffies(SMC_TIMEOUT_MS)) == 0) {
   447			dev_err(dev, "Timed out initializing SMC");
   448			return -ETIMEDOUT;
   449		}
   450	
   451		if (smc->boot_stage != APPLE_SMC_INITIALIZED) {
   452			dev_err(dev, "SMC failed to boot successfully, boot stage=%d\n", smc->boot_stage);
   453			return -EIO;
   454		}
   455	
   456		dev_set_drvdata(&pdev->dev, smc);
   457		BLOCKING_INIT_NOTIFIER_HEAD(&smc->event_handlers);
   458	
   459		ret = apple_smc_read_u32(smc, SMC_KEY(#KEY), &count);
   460		if (ret)
   461			return dev_err_probe(smc->dev, ret, "Failed to get key count");
 > 462		smc->key_count = be32_to_cpu(count);
   463	
   464		/* Enable notifications */
   465		apple_smc_write_flag(smc, SMC_KEY(NTAP), true);
   466		ret = devm_add_action_or_reset(dev, apple_smc_disable_notifications, smc);
   467		if (ret)
   468			return dev_err_probe(dev, ret, "Failed to register notification disable action");
   469	
   470		ret = devm_mfd_add_devices(smc->dev, PLATFORM_DEVID_NONE,
   471					   apple_smc_devs, ARRAY_SIZE(apple_smc_devs),
   472					   NULL, 0, NULL);
   473		if (ret)
   474			return dev_err_probe(smc->dev, ret, "Failed to register sub-devices");
   475	
   476	
   477		return 0;
   478	}
   479	

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-07-18  2:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-11 14:50 drivers/mfd/macsmc.c:462:26: sparse: sparse: cast to restricted __be32 kernel test robot
2026-07-18  2:48 kernel test robot

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®