Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Feb 2026 00:46:43 +0000
From:      Bjoern A. Zeeb <bz@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 1f19fc2632c9 - main - LinuxKPI: pci: make sure a tailq and lock are initialized
Message-ID:  <698a7ff3.31e5d.1da86e2a@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=1f19fc2632c98cfe653a082b5fcb02d16053ed06

commit 1f19fc2632c98cfe653a082b5fcb02d16053ed06
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2026-01-24 22:16:36 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2026-02-09 21:49:30 +0000

    LinuxKPI: pci: make sure a tailq and lock are initialized
    
    Move the initializations of the tailq and lock from
    linux_pci_attach_device() into lkpifill_pci_dev() so that they are
    initialized in all cases we create a device (see all the possible
    callers of lkpifill_pci_dev()).
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      3 days
    Reviewed by:    emaste, dumbbell
    Differential Revision: https://reviews.freebsd.org/D54861
---
 sys/compat/linuxkpi/common/src/linux_pci.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/sys/compat/linuxkpi/common/src/linux_pci.c b/sys/compat/linuxkpi/common/src/linux_pci.c
index 612a2cb5f46b..477cb321ea9e 100644
--- a/sys/compat/linuxkpi/common/src/linux_pci.c
+++ b/sys/compat/linuxkpi/common/src/linux_pci.c
@@ -385,14 +385,16 @@ lkpifill_pci_dev(device_t dev, struct pci_dev *pdev)
 	pdev->dev.bsddev = dev;
 	pdev->dev.parent = &linux_root_device;
 	pdev->dev.release = lkpi_pci_dev_release;
-	INIT_LIST_HEAD(&pdev->dev.irqents);
 
 	if (pci_msi_count(dev) > 0)
 		pdev->msi_desc = malloc(pci_msi_count(dev) *
 		    sizeof(*pdev->msi_desc), M_DEVBUF, M_WAITOK | M_ZERO);
 
+	TAILQ_INIT(&pdev->mmio);
+	spin_lock_init(&pdev->pcie_cap_lock);
 	spin_lock_init(&pdev->dev.devres_lock);
 	INIT_LIST_HEAD(&pdev->dev.devres_head);
+	INIT_LIST_HEAD(&pdev->dev.irqents);
 
 	return (0);
 }
@@ -613,9 +615,6 @@ linux_pci_attach_device(device_t dev, struct pci_driver *pdrv,
 	if (error)
 		goto out_dma_init;
 
-	TAILQ_INIT(&pdev->mmio);
-	spin_lock_init(&pdev->pcie_cap_lock);
-
 	spin_lock(&pci_lock);
 	list_add(&pdev->links, &pci_devices);
 	spin_unlock(&pci_lock);


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?698a7ff3.31e5d.1da86e2a>