[PATCH 03/17] i3c: mipi-i3c-hci-pci: Set drvdata before creating LTR sysfs attribute

sashiko-bot at kernel.org sashiko-bot at kernel.org
Mon Sep 14 04:45:09 PDT 2026


Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Missing pci_free_irq_vectors() on probe error paths and in remove(), leading to leaked IRQ resources.
--

commit acaee14d38f933d8badb9700cafe410fa4c357fa
Author: Adrian Hunter <adrian.hunter at intel.com>

i3c: mipi-i3c-hci-pci: Set drvdata before creating LTR sysfs attribute

This patch moves pci_set_drvdata() before the hci->info->init() call in probe
to ensure drvdata is available before the pm_qos_latency_tolerance_us sysfs
attribute becomes accessible to userspace.

Fixes: 884a33131f2a ("i3c: mipi-i3c-hci-pci: Add LTR support for Intel controllers")
Cc: stable at vger.kernel.org

> diff --git a/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c b/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c
> index ab595661db1e8..af9595009b03a 100644
> --- a/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c
> +++ b/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c
> @@ -445,6 +445,8 @@ static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
>  	if (ret < 0)
>  		return ret;
>  
> +	pci_set_drvdata(pci, hci);
> +
>  	hci->info = (const struct mipi_i3c_hci_pci_info *)id->driver_data;
>  
>  	ret = hci->info->init ? hci->info->init(hci) : 0;
>  	if (ret)
>  		return ret;

[Severity: High]
This is a pre-existing issue, but does this error path leak the IRQ vectors
allocated earlier in mipi_i3c_hci_pci_probe()?

If hci->info->init() fails, the function returns directly. Failing to call
pci_free_irq_vectors() after a successful pci_alloc_irq_vectors() leaks IRQ
resources, which can prevent future allocations and exhaust system capacity.

The same issue appears to exist in the shared error exit path when subsequent
initialization steps fail:

err_exit:
	if (hci->info->exit)
		hci->info->exit(hci);
	return ret;

And also during device removal in mipi_i3c_hci_pci_remove():

static void mipi_i3c_hci_pci_remove(struct pci_dev *pci)
{
	struct mipi_i3c_hci_pci *hci = pci_get_drvdata(pci);

	if (hci->info->exit)
		hci->info->exit(hci);

	mipi_i3c_hci_pci_rpm_forbid(&pci->dev);

	mfd_remove_devices(&pci->dev);
}

Should there be calls to pci_free_irq_vectors() in these locations to ensure
the allocated IRQ vectors are properly freed on probe failure and when the
device is unbound?

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260914113003.183150-1-adrian.hunter@intel.com?part=3



More information about the linux-i3c mailing list