From: kernel test robot <lkp@intel.com>
To: Wentao Liang <vulab@iscas.ac.cn>, bhelgaas@google.com
Cc: oe-kbuild-all@lists.linux.dev, mika.westerberg@linux.intel.com,
mani@kernel.org, andriy.shevchenko@intel.com, kees@kernel.org,
adiyenga@cisco.com, vulab@iscas.ac.cn, linux-pci@vger.kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] PCI/PTM: fix refcount leak in pci_enable_ptm()
Date: Wed, 17 Jun 2026 15:38:57 +0800 [thread overview]
Message-ID: <202606171537.E42T5ZLo-lkp@intel.com> (raw)
In-Reply-To: <20260616141733.1688264-1-vulab@iscas.ac.cn>
Hi Wentao,
kernel test robot noticed the following build errors:
[auto build test ERROR on pci/next]
[also build test ERROR on pci/for-linus westeri-thunderbolt/next linus/master v7.1 next-20260616]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Wentao-Liang/PCI-PTM-fix-refcount-leak-in-pci_enable_ptm/20260617-043856
base: https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git next
patch link: https://lore.kernel.org/r/20260616141733.1688264-1-vulab%40iscas.ac.cn
patch subject: [PATCH] PCI/PTM: fix refcount leak in pci_enable_ptm()
config: s390-randconfig-r072-20260617 (https://download.01.org/0day-ci/archive/20260617/202606171537.E42T5ZLo-lkp@intel.com/config)
compiler: s390-linux-gcc (GCC) 8.5.0
smatch: v0.5.0-9185-gbcc58b9c
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260617/202606171537.E42T5ZLo-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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202606171537.E42T5ZLo-lkp@intel.com/
All errors (new ones prefixed by >>):
drivers/pci/pcie/ptm.c: In function 'pci_enable_ptm':
>> drivers/pci/pcie/ptm.c:204:20: error: 'parent' undeclared (first use in this function); did you mean 'xa_parent'?
pci_disable_ptm(parent);
^~~~~~
xa_parent
drivers/pci/pcie/ptm.c:204:20: note: each undeclared identifier is reported only once for each function it appears in
vim +204 drivers/pci/pcie/ptm.c
162
163 /**
164 * pci_enable_ptm() - Enable Precision Time Measurement
165 * @dev: PCI device
166 *
167 * Enable Precision Time Measurement for @dev.
168 *
169 * Return: zero if successful, or -EINVAL if @dev lacks a PTM Capability or
170 * is not a PTM Root and lacks an upstream path of PTM-enabled devices.
171 */
172 int pci_enable_ptm(struct pci_dev *dev)
173 {
174 int rc;
175 char clock_desc[8];
176
177 /*
178 * A device uses local PTM Messages to request time information
179 * from a PTM Root that's farther upstream. Every device along
180 * the path must support PTM and have it enabled so it can
181 * handle the messages. Therefore, if this device is not a PTM
182 * Root, the upstream link partner must have PTM enabled before
183 * we can enable PTM.
184 */
185 if (!dev->ptm_root) {
186 struct pci_dev *parent;
187
188 parent = pci_upstream_ptm(dev);
189 if (!parent)
190 return -EINVAL;
191 /* Enable PTM for the parent */
192 rc = pci_enable_ptm(parent);
193 if (rc)
194 return rc;
195 }
196
197 /* Already enabled? */
198 if (atomic_inc_return(&dev->ptm_enable_cnt) > 1)
199 return 0;
200
201 rc = __pci_enable_ptm(dev);
202 if (rc) {
203 if (!dev->ptm_root)
> 204 pci_disable_ptm(parent);
205 atomic_dec(&dev->ptm_enable_cnt);
206 return rc;
207 }
208
209 switch (dev->ptm_granularity) {
210 case 0:
211 snprintf(clock_desc, sizeof(clock_desc), "unknown");
212 break;
213 case 255:
214 snprintf(clock_desc, sizeof(clock_desc), ">254ns");
215 break;
216 default:
217 snprintf(clock_desc, sizeof(clock_desc), "%uns",
218 dev->ptm_granularity);
219 break;
220 }
221 pci_info(dev, "PTM enabled%s, %s granularity\n",
222 dev->ptm_root ? " (root)" : "", clock_desc);
223
224 return 0;
225 }
226 EXPORT_SYMBOL(pci_enable_ptm);
227
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
prev parent reply other threads:[~2026-06-17 7:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-16 14:17 [PATCH] PCI/PTM: fix refcount leak in pci_enable_ptm() Wentao Liang
2026-06-16 14:25 ` sashiko-bot
2026-06-17 4:02 ` kernel test robot
2026-06-17 7:38 ` kernel test robot [this message]
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=202606171537.E42T5ZLo-lkp@intel.com \
--to=lkp@intel.com \
--cc=adiyenga@cisco.com \
--cc=andriy.shevchenko@intel.com \
--cc=bhelgaas@google.com \
--cc=kees@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=mani@kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=stable@vger.kernel.org \
--cc=vulab@iscas.ac.cn \
/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