mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Sven Peter <sven@kernel.org>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
	Lee Jones <lee@kernel.org>, Hector Martin <marcan@marcan.st>,
	Alyssa Rosenzweig <alyssa@rosenzweig.io>,
	Neal Gompa <neal@gompa.dev>
Subject: drivers/mfd/macsmc.c:462:26: sparse: sparse: cast to restricted __be32
Date: Sat, 18 Jul 2026 10:48:54 +0800	[thread overview]
Message-ID: <202607181046.OANjIoqR-lkp@intel.com> (raw)

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

             reply	other threads:[~2026-07-18  2:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-18  2:48 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-06-11 14:50 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=202607181046.OANjIoqR-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=alyssa@rosenzweig.io \
    --cc=lee@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcan@marcan.st \
    --cc=neal@gompa.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=sven@kernel.org \
    /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®