mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Ben Horgan <ben.horgan@arm.com>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
	James Morse <james.morse@arm.com>,
	Zeng Heng <zengheng4@huawei.com>,
	Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>,
	Jonathan Cameron <jonathan.cameron@huawei.com>,
	Gavin Shan <gshan@redhat.com>
Subject: drivers/resctrl/mpam_devices.c:1860:35-38: WARNING: Suspicious code. resource_size is maybe missing with msc_res
Date: Thu, 03 Sep 2026 09:01:51 +0800	[thread overview]
Message-ID: <202609030809.ObirDhR3-lkp@intel.com> (raw)

Hi Ben,

First bad commit (maybe != root cause):

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   89a312991dc6e638a36adc43ccb91dbc25504c04
commit: c544f00a473239835d22e7109b403314d8b85974 arm64: mpam: Drop the CONFIG_EXPERT restriction
date:   5 months ago
config: arm64-randconfig-r051-20260902 (https://download.01.org/0day-ci/archive/20260903/202609030809.ObirDhR3-lkp@intel.com/config)
compiler: clang version 24.0.0git (https://github.com/llvm/llvm-project 2c2cffa015e9549aafba9e514384b08204c7cc4b)

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: c544f00a4732 ("arm64: mpam: Drop the CONFIG_EXPERT restriction")
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202609030809.ObirDhR3-lkp@intel.com/

cocci warnings: (new ones prefixed by >>)
>> drivers/resctrl/mpam_devices.c:1860:35-38: WARNING: Suspicious code. resource_size is maybe missing with msc_res

vim +1860 drivers/resctrl/mpam_devices.c

f04046f2577a5c James Morse 2025-11-19  1797  
f04046f2577a5c James Morse 2025-11-19  1798  static struct mpam_msc *do_mpam_msc_drv_probe(struct platform_device *pdev)
f04046f2577a5c James Morse 2025-11-19  1799  {
f04046f2577a5c James Morse 2025-11-19  1800  	int err;
f04046f2577a5c James Morse 2025-11-19  1801  	u32 tmp;
f04046f2577a5c James Morse 2025-11-19  1802  	struct mpam_msc *msc;
f04046f2577a5c James Morse 2025-11-19  1803  	struct resource *msc_res;
f04046f2577a5c James Morse 2025-11-19  1804  	struct device *dev = &pdev->dev;
f04046f2577a5c James Morse 2025-11-19  1805  
f04046f2577a5c James Morse 2025-11-19  1806  	lockdep_assert_held(&mpam_list_lock);
f04046f2577a5c James Morse 2025-11-19  1807  
f04046f2577a5c James Morse 2025-11-19  1808  	msc = devm_kzalloc(&pdev->dev, sizeof(*msc), GFP_KERNEL);
f04046f2577a5c James Morse 2025-11-19  1809  	if (!msc)
f04046f2577a5c James Morse 2025-11-19  1810  		return ERR_PTR(-ENOMEM);
01fb4b8224726a James Morse 2025-11-19  1811  	init_garbage(&msc->garbage);
01fb4b8224726a James Morse 2025-11-19  1812  	msc->garbage.pdev = pdev;
f04046f2577a5c James Morse 2025-11-19  1813  
f04046f2577a5c James Morse 2025-11-19  1814  	err = devm_mutex_init(dev, &msc->probe_lock);
f04046f2577a5c James Morse 2025-11-19  1815  	if (err)
f04046f2577a5c James Morse 2025-11-19  1816  		return ERR_PTR(err);
f04046f2577a5c James Morse 2025-11-19  1817  
f04046f2577a5c James Morse 2025-11-19  1818  	err = devm_mutex_init(dev, &msc->part_sel_lock);
f04046f2577a5c James Morse 2025-11-19  1819  	if (err)
f04046f2577a5c James Morse 2025-11-19  1820  		return ERR_PTR(err);
f04046f2577a5c James Morse 2025-11-19  1821  
49aa621c4dcaf8 James Morse 2025-11-19  1822  	err = devm_mutex_init(dev, &msc->error_irq_lock);
49aa621c4dcaf8 James Morse 2025-11-19  1823  	if (err)
49aa621c4dcaf8 James Morse 2025-11-19  1824  		return ERR_PTR(err);
09b89d2a72f37b James Morse 2025-11-19  1825  
09b89d2a72f37b James Morse 2025-11-19  1826  	err = devm_mutex_init(dev, &msc->cfg_lock);
09b89d2a72f37b James Morse 2025-11-19  1827  	if (err)
09b89d2a72f37b James Morse 2025-11-19  1828  		return ERR_PTR(err);
09b89d2a72f37b James Morse 2025-11-19  1829  
d02beb06ca2a62 James Morse 2025-11-19  1830  	mpam_mon_sel_lock_init(msc);
f04046f2577a5c James Morse 2025-11-19  1831  	msc->id = pdev->id;
f04046f2577a5c James Morse 2025-11-19  1832  	msc->pdev = pdev;
f04046f2577a5c James Morse 2025-11-19  1833  	INIT_LIST_HEAD_RCU(&msc->all_msc_list);
f04046f2577a5c James Morse 2025-11-19  1834  	INIT_LIST_HEAD_RCU(&msc->ris);
f04046f2577a5c James Morse 2025-11-19  1835  
f04046f2577a5c James Morse 2025-11-19  1836  	update_msc_accessibility(msc);
f04046f2577a5c James Morse 2025-11-19  1837  	if (cpumask_empty(&msc->accessibility)) {
f04046f2577a5c James Morse 2025-11-19  1838  		dev_err_once(dev, "MSC is not accessible from any CPU!");
f04046f2577a5c James Morse 2025-11-19  1839  		return ERR_PTR(-EINVAL);
f04046f2577a5c James Morse 2025-11-19  1840  	}
f04046f2577a5c James Morse 2025-11-19  1841  
49aa621c4dcaf8 James Morse 2025-11-19  1842  	err = mpam_msc_setup_error_irq(msc);
49aa621c4dcaf8 James Morse 2025-11-19  1843  	if (err)
49aa621c4dcaf8 James Morse 2025-11-19  1844  		return ERR_PTR(err);
49aa621c4dcaf8 James Morse 2025-11-19  1845  
f04046f2577a5c James Morse 2025-11-19  1846  	if (device_property_read_u32(&pdev->dev, "pcc-channel", &tmp))
f04046f2577a5c James Morse 2025-11-19  1847  		msc->iface = MPAM_IFACE_MMIO;
f04046f2577a5c James Morse 2025-11-19  1848  	else
f04046f2577a5c James Morse 2025-11-19  1849  		msc->iface = MPAM_IFACE_PCC;
f04046f2577a5c James Morse 2025-11-19  1850  
f04046f2577a5c James Morse 2025-11-19  1851  	if (msc->iface == MPAM_IFACE_MMIO) {
f04046f2577a5c James Morse 2025-11-19  1852  		void __iomem *io;
f04046f2577a5c James Morse 2025-11-19  1853  
f04046f2577a5c James Morse 2025-11-19  1854  		io = devm_platform_get_and_ioremap_resource(pdev, 0,
f04046f2577a5c James Morse 2025-11-19  1855  							    &msc_res);
f04046f2577a5c James Morse 2025-11-19  1856  		if (IS_ERR(io)) {
f04046f2577a5c James Morse 2025-11-19  1857  			dev_err_once(dev, "Failed to map MSC base address\n");
f04046f2577a5c James Morse 2025-11-19  1858  			return ERR_CAST(io);
f04046f2577a5c James Morse 2025-11-19  1859  		}
f04046f2577a5c James Morse 2025-11-19 @1860  		msc->mapped_hwpage_sz = msc_res->end - msc_res->start;
f04046f2577a5c James Morse 2025-11-19  1861  		msc->mapped_hwpage = io;
f04046f2577a5c James Morse 2025-11-19  1862  	} else {
f04046f2577a5c James Morse 2025-11-19  1863  		return ERR_PTR(-EINVAL);
f04046f2577a5c James Morse 2025-11-19  1864  	}
f04046f2577a5c James Morse 2025-11-19  1865  
f04046f2577a5c James Morse 2025-11-19  1866  	list_add_rcu(&msc->all_msc_list, &mpam_all_msc);
f04046f2577a5c James Morse 2025-11-19  1867  	platform_set_drvdata(pdev, msc);
f04046f2577a5c James Morse 2025-11-19  1868  
f04046f2577a5c James Morse 2025-11-19  1869  	return msc;
f04046f2577a5c James Morse 2025-11-19  1870  }
f04046f2577a5c James Morse 2025-11-19  1871  

:::::: The code at line 1860 was first introduced by commit
:::::: f04046f2577a5c76167333ca99d3903ee5331ba0 arm_mpam: Add probe/remove for mpam msc driver and kbuild boiler plate

:::::: TO: James Morse <james.morse@arm.com>
:::::: CC: Catalin Marinas <catalin.marinas@arm.com>

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

             reply	other threads:[~2026-09-03  1:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-03  1:01 kernel test robot [this message]
2026-09-03 11:02 ` Ilpo Järvinen
2026-09-03 13:16   ` Ben Horgan

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=202609030809.ObirDhR3-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=ben.horgan@arm.com \
    --cc=gshan@redhat.com \
    --cc=james.morse@arm.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=tan.shaopeng@jp.fujitsu.com \
    --cc=zengheng4@huawei.com \
    /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®