diff options
| author | Hans Petter Selasky <hselasky@FreeBSD.org> | 2019-05-09 10:23:42 +0000 |
|---|---|---|
| committer | Hans Petter Selasky <hselasky@FreeBSD.org> | 2019-05-09 10:23:42 +0000 |
| commit | e2eb11e5778e2804b4a61dd31804795d0dabdc35 (patch) | |
| tree | ea645f24fc76c6fad208d26bd5de62aed06084e9 /sys/compat/linuxkpi | |
| parent | eb6f534241c9cc4343a38f78e8eb07bf9eb02da4 (diff) | |
Notes
Diffstat (limited to 'sys/compat/linuxkpi')
| -rw-r--r-- | sys/compat/linuxkpi/common/src/linux_pci.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/sys/compat/linuxkpi/common/src/linux_pci.c b/sys/compat/linuxkpi/common/src/linux_pci.c index 6d04e08e20eb..56015b53ed90 100644 --- a/sys/compat/linuxkpi/common/src/linux_pci.c +++ b/sys/compat/linuxkpi/common/src/linux_pci.c @@ -251,12 +251,10 @@ linux_pci_attach(device_t dev) if (error) goto out_dma_init; - if (pdev->bus == NULL) { - pbus = malloc(sizeof(*pbus), M_DEVBUF, M_WAITOK | M_ZERO); - pbus->self = pdev; - pbus->number = pci_get_bus(dev); - pdev->bus = pbus; - } + pbus = malloc(sizeof(*pbus), M_DEVBUF, M_WAITOK | M_ZERO); + pbus->self = pdev; + pbus->number = pci_get_bus(dev); + pdev->bus = pbus; spin_lock(&pci_lock); list_add(&pdev->links, &pci_devices); @@ -268,6 +266,7 @@ linux_pci_attach(device_t dev) return (0); out_probe: + free(pdev->bus, M_DEVBUF); linux_pdev_dma_uninit(pdev); out_dma_init: spin_lock(&pci_lock); @@ -286,6 +285,8 @@ linux_pci_detach(device_t dev) pdev = device_get_softc(dev); pdev->pdrv->remove(pdev); + + free(pdev->bus, M_DEVBUF); linux_pdev_dma_uninit(pdev); spin_lock(&pci_lock); |
