Re: [PATCH v2] idpf: disable PCIe PTM on probe failure and removal
From: Mina Almasry
Date: Wed Jul 15 2026 - 14:13:59 EST
On Wed, Jul 15, 2026 at 12:44 AM Myeonghun Pak <mhun512@xxxxxxxxx> wrote:
>
> idpf_probe() enables PCIe Precision Time Measurement with
> pci_enable_ptm(pdev, NULL), which programs the PTM control bits and sets
> pdev->ptm_enabled when the bus/controller supports it.
>
> If a later probe step fails, the error path releases the allocated
> workqueues and adapter memory without disabling PTM. The remove path has
> the same imbalance when a successfully probed device is detached. In
> both cases, the PCI core's software PTM state and the device's PTM control
> bits remain set with no bound driver.
>
> Add pci_disable_ptm() to the common probe unwind after the PTM enable and
> to idpf_remove(). pci_disable_ptm() is a no-op when PTM was not enabled,
> so the non-fatal pci_enable_ptm() failure remains safe.
> pcim_enable_device() only arranges for pci_disable_device() and does not
> undo the PTM enable.
>
> Fixes: 8d5e12c5921c ("idpf: add initial PTP support")
> Co-developed-by: Ijae Kim <ae878000@xxxxxxxxx>
> Signed-off-by: Ijae Kim <ae878000@xxxxxxxxx>
> Signed-off-by: Myeonghun Pak <mhun512@xxxxxxxxx>
Reviewed-by: Mina Almasry <almasrymina@xxxxxxxxxx>
--
Thanks,
Mina